oneby-wang commented on PR #24698: URL: https://github.com/apache/pulsar/pull/24698#issuecomment-3252173863
Hi, @lhotari there is a test failure in [Pulsar CI / CI - Unit - Pulsar Client (pull_request)](https://github.com/apache/pulsar/actions/runs/17453872406/job/49565356595?pr=24698), I think the problem is `TopicListWatcher.connectionFailed()` method doesn't have a dealineTime or maxRetryCount. If PulsarClient connection is closed, `watcherFuture` will never complete. https://github.com/apache/pulsar/blob/2e6a8eb1f200ca687064058a101963713b896fe2/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TopicListWatcher.java#L92-L107 My local test output: ``` 13:28:39.441 [pulsar-client-internal-36-1] INFO org.apache.pulsar.client.impl.MultiTopicsConsumerImpl - [MultiTopicsConsumer-6hKvG] [with-pulsar-topic-builder-ensure-topics-pattern-fully-qualified-sub] Closed Topics Consumer 13:28:39.443 [Test worker] INFO org.apache.pulsar.client.impl.PulsarClientImpl - Client closing. URL: pulsar://localhost:60422 13:28:39.454 [pulsar-client-io-23-3] INFO org.apache.pulsar.client.impl.ClientCnx - [id: 0xc4959e73, L:/[127.0.0.1:60463](http://127.0.0.1:60463/) ! R:localhost/[127.0.0.1:60422](http://127.0.0.1:60422/)] Disconnected 13:28:39.462 [pulsar-client-io-23-3] WARN org.apache.pulsar.client.impl.BinaryProtoLookupService - [persistent://public/default/topic-.*] failed to send lookup request : Disconnected from server at localhost/[127.0.0.1:60422](http://127.0.0.1:60422/) 13:28:39.462 [pulsar-client-io-23-3] WARN org.apache.pulsar.client.impl.ConnectionHandler - [persistent://public/default/topic-.*] [Watcher(org.apache.pulsar.common.topics.RE2JTopicsPattern@432ed00c)] Error connecting to broker: org.apache.pulsar.client.api.PulsarClientException$ConnectException: Disconnected from server at localhost/[127.0.0.1:60422](http://127.0.0.1:60422/) 13:28:39.463 [pulsar-client-io-23-3] WARN org.apache.pulsar.client.impl.ConnectionHandler - [persistent://public/default/topic-.*] [Watcher(org.apache.pulsar.common.topics.RE2JTopicsPattern@432ed00c)] Could not get connection to broker: org.apache.pulsar.client.api.PulsarClientException$ConnectException: Disconnected from server at localhost/[127.0.0.1:60422](http://127.0.0.1:60422/) -- Will try again in 0.1 s 13:28:39.591 [pulsar-timer-43-1] INFO org.apache.pulsar.client.impl.ConnectionHandler - [persistent://public/default/topic-.*] [Watcher(org.apache.pulsar.common.topics.RE2JTopicsPattern@432ed00c)] Reconnecting after connection was closed 13:28:39.853 [pulsar-client-io-23-6] WARN org.apache.pulsar.client.impl.ConnectionPool - Failed to open connection to localhost/<unresolved>:60422 : java.nio.channels.ClosedChannelException 13:28:39.854 [pulsar-client-io-23-6] WARN org.apache.pulsar.client.impl.ConnectionHandler - [persistent://public/default/topic-.*] [Watcher(org.apache.pulsar.common.topics.RE2JTopicsPattern@432ed00c)] Error connecting to broker: org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: java.nio.channels.ClosedChannelException 13:28:39.854 [pulsar-client-io-23-6] WARN org.apache.pulsar.client.impl.ConnectionHandler - [persistent://public/default/topic-.*] [Watcher(org.apache.pulsar.common.topics.RE2JTopicsPattern@432ed00c)] Could not get connection to broker: org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.CompletionException: java.nio.channels.ClosedChannelException -- Will try again in 0.183 s 13:28:40.039 [pulsar-timer-43-1] INFO org.apache.pulsar.client.impl.ConnectionHandler - [persistent://public/default/topic-.*] [Watcher(org.apache.pulsar.common.topics.RE2JTopicsPattern@432ed00c)] Reconnecting after connection was closed ``` I read the source code of ConsumerImpl.connectionFailed() method, and I prepare to use `this.lookupDeadline = System.currentTimeMillis() + client.getConfiguration().getLookupTimeoutMs();` as `watcherFuture`'s deadline. I think it is reasonable, because TopicListWatcher and TopicLookup are kind of same things. https://github.com/apache/pulsar/blob/2e6a8eb1f200ca687064058a101963713b896fe2/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1123-L1151 -- 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]
