psisoyev opened a new issue #7332:
URL: https://github.com/apache/pulsar/issues/7332
**Describe the bug**
Found this when using Java client API.
When Pulsar Function sends a message to a topic using `newOutputMessage` it
creates a new producer, which is then never closed. This leads to topics not
being garbage collected.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a topic A
2. Create a Function that listens to topic A
3. Inside the function send a message to topic B
4. Topic B is never garbage collected
**Expected behavior**
Client B is cleaned up after a while.
**Desktop (please complete the following information):**
- OS: Any
- Client: Java, but didn't try others
**Additional context**
Usually, if there are no producers, consumers and subscriptions, the broker
will treat a topic as inactive and delete it after a certain time. In scenario
above the producer is created by a Function and is never closed even though it
might be never used again. Restarting/shutting down the function helps.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]