[Bug][broker] Producer still publishes messages to Broker after Topic was unloaded.
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before reporting
- [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Read release policy
- [x] I understand that [unsupported versions](https://pulsar.apache.org/contribute/release-policy/#supported-versions) don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
### User environment
Broker version: 4.1.0
### Issue Description
After unloading a bundle with many non-persistent topics from Broker, we found some producers in `ProducerAccessMode.Shared` mode were still publishing messages to the broker. Even thought the topic was not loaded by the broker any more.
### Error messages
```text
```
### Reproducing the issue
Run [AbstractTopicTest#testOverwriteOldProducerAfterTopicClosed](https://github.com/apache/pulsar/blob/8c6eb0c5d1541d49451cecfa2af43cef71def416/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/AbstractTopicTest.java#L120)
### Additional information
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
Research direction
Start by running AbstractTopicTest#testOverwriteOldProducerAfterTopicClosed in pulsar-broker/src/test/java/org/apache/pulsar/broker/service/AbstractTopicTest.java. Reproduce the unload scenario and verify that producers in Shared mode no longer publish after the topic is unloaded; the test should pass with that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100