tonyvelichko opened a new issue #12024:
URL: https://github.com/apache/pulsar/issues/12024


   **Endless receive retries on closed consumer**
   
   **To Reproduce**
   Start the consumer, then close it async when the readBatchAsync hasn't 
finished yet. The result would be repeating trying to read from consumers, that 
never finished. 
   
   I think the root cause is here, it seems to the ClientClosed exception 
should explicitly stop the retrying: 
   
https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L247
   
   After a while, all logs are full of messages about rescheduling receiving 
from closed consumers.
   
   ```
   2021-09-13T13:31:52,025 ERROR [pulsar-client-internal-23-1] 
org.apache.pulsar.client.impl.MultiTopicsConsumerImpl - Receive operation 
failed on consumer 
ConsumerBase{subscription='003e2371-a590-00d8-9046-88891c6ff5df', 
consumerName='test-system.test-group', topic='persistent://***/***/***'} - 
Retrying later
   java.util.concurrent.CompletionException: 
org.apache.pulsar.client.api.PulsarClientException$AlreadyClosedException: 
Consumer already closed
        at 
java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
 ~[?:?]
        at 
java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:743) 
~[?:?]
        at 
java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:731)
 ~[?:?]
        at 
java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2178) 
~[?:?]
        at 
org.apache.pulsar.client.impl.MultiTopicsConsumerImpl.receiveMessageFromConsumer(MultiTopicsConsumerImpl.java:248)
 ~[org.apache.pulsar.pulsar-client-2.8.1.jar:2.8.1]
        at 
org.apache.pulsar.client.impl.MultiTopicsConsumerImpl.lambda$receiveMessageFromConsumer$9(MultiTopicsConsumerImpl.java:274)
 ~[org.apache.pulsar.pulsar-client-2.8.1.jar:2.8.1]
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
 [?:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) 
[?:?]
        at 
org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [org.apache.pulsar.pulsar-client-2.8.1.jar:2.8.1]
        at java.lang.Thread.run(Thread.java:831) [?:?]
   Caused by: 
org.apache.pulsar.client.api.PulsarClientException$AlreadyClosedException: 
Consumer already closed
        at 
org.apache.pulsar.client.impl.ConsumerBase.verifyConsumerState(ConsumerBase.java:754)
 ~[org.apache.pulsar.pulsar-client-2.8.1.jar:2.8.1]
        at 
org.apache.pulsar.client.impl.ConsumerBase.receiveAsync(ConsumerBase.java:162) 
~[org.apache.pulsar.pulsar-client-2.8.1.jar:2.8.1]
   ```
   
   
   **Expected behavior**
   For closed subscribers, all his resources should be closed as well. 


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to