You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/09/29 10:02:11 UTC

[GitHub] [pulsar] massakam commented on issue #5288: [pulsar-broker] Close previous dispatcher when subscription type changes

massakam commented on issue #5288: [pulsar-broker] Close previous dispatcher when subscription type changes
URL: https://github.com/apache/pulsar/pull/5288#issuecomment-536277568
 
 
   @codelipenghui 
   > I noticed if all consumer disconnected in a subscription, the topic will remove this subscription and the dispatcher is maintained by the subscription. So why don't close previous dispatcher will cause a memory leak, maybe i have not get your point here.
   
   The problem is that the rate limiter used for dispatch throttling is only closed in the `close()` method of dispatcher.
   https://github.com/apache/pulsar/blob/b9e7bf3a828fd6f7f9d3a1eaaaebc1ca107b15f6/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java#L374-L376
   https://github.com/apache/pulsar/blob/b9e7bf3a828fd6f7f9d3a1eaaaebc1ca107b15f6/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/DispatchRateLimiter.java#L334-L344
   
   And if the `RateLimiter` object is not closed, the `renewTask` executed every second will continue to run without being cancelled. Therefore, even if the dispatcher is garbage collected, `RateLimiter` is not removed.
   https://github.com/apache/pulsar/blob/b9e7bf3a828fd6f7f9d3a1eaaaebc1ca107b15f6/pulsar-common/src/main/java/org/apache/pulsar/common/util/RateLimiter.java#L87-L98

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services