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 2021/06/21 08:59:41 UTC

[GitHub] [pulsar] Shoothzj opened a new issue #10996: MutliConsumer not released after calling method unsubscribe

Shoothzj opened a new issue #10996:
URL: https://github.com/apache/pulsar/issues/10996


   **Describe the bug**
   MutliConsumer not released after calling method unsubscribe, and can't be released by other method.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Create a MultiTopicConsumer
   2. Unsubscribe the topoc
   3. Jmap print live objects
   4. See MultiTopicConsumer stiil there
   
   **Expected behavior**
   Jmap live objects do not show MultiTopicConsumer
   
   **Demo Code**
   ```java
   public class PulsarMutliConsumerMemoryLeak {
   
       public static void main(String[] args) throws Exception {
           TopicService.createTopic("test-multi-topic", 2);
           final ConsumerBuilder<byte[]> consumerBuilder = PulsarUtil.pulsarClient().newConsumer();
           final Consumer<byte[]> consumer = consumerBuilder.topic("test-multi").subscriptionName("sub-1").subscribe();
           consumer.unsubscribe();
           CommonUtil.sleep(TimeUnit.DAYS, 1);
       }
   
   }
   ```
   **Screenshots**
   ![image](https://user-images.githubusercontent.com/12933197/122735904-0849d480-d2b2-11eb-93a1-925845532b30.png)
   
   
   


-- 
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



[GitHub] [pulsar] Shoothzj commented on issue #10996: MutliConsumer not released after calling method unsubscribe

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on issue #10996:
URL: https://github.com/apache/pulsar/issues/10996#issuecomment-865908126


   Fixed in this PR
   https://github.com/apache/pulsar/pull/10997


-- 
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



[GitHub] [pulsar] BewareMyPower commented on issue #10996: MutliConsumer not released after calling method unsubscribe

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on issue #10996:
URL: https://github.com/apache/pulsar/issues/10996#issuecomment-865859762


   Does `consumer.close()` work? `unsubscribe()` is just to send an UNSUBSCRIBE command to broker. For `MultiTopicsConsumer`, it calls `unsubscribe()` method for each single topic.


-- 
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



[GitHub] [pulsar] Shoothzj closed issue #10996: MutliConsumer not released after calling method unsubscribe

Posted by GitBox <gi...@apache.org>.
Shoothzj closed issue #10996:
URL: https://github.com/apache/pulsar/issues/10996


   


-- 
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



[GitHub] [pulsar] Shoothzj commented on issue #10996: MutliConsumer not released after calling method unsubscribe

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on issue #10996:
URL: https://github.com/apache/pulsar/issues/10996#issuecomment-865907443


   > Does `consumer.close()` work? `unsubscribe()` is just to send an UNSUBSCRIBE command to broker. For `MultiTopicsConsumer`, it calls `unsubscribe()` method for each single topic.
   
   `Consumer.close()` work, but when you call `unsubscribe()`, it changes the state to `Closing`, and then U can't call `close` any more. And the `ConsumerImpl` close the consumer, while `MultiConsumerImpl` doesn't.


-- 
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