BewareMyPower commented on code in PR #20595:
URL: https://github.com/apache/pulsar/pull/20595#discussion_r1246019082


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:
##########
@@ -100,7 +102,7 @@ protected void grabCnx() {
                             log.error("[{}] [{}] Unexpected exception after 
the connection",
                                     state.topic, state.getHandlerName(), e);
                         }
-                        duringConnect = false;
+                        duringConnect.compareAndSet(true, false);

Review Comment:
   I think what affects is  the step 7 and 8. The root cause is caused by 
https://github.com/apache/pulsar/pull/20595#discussion_r1245264041, when 
`reconnectLater` is called in `connectionOpened`, since the future is completed 
exceptionally, `handleConnectionError` will be called and `reconnectLater` will 
be called again.
   
   ```java
               cnxFuture.thenCompose(cnx -> connection.connectionOpened(cnx))
                       .thenAccept(__ -> duringConnect.set(false))
                       .exceptionally(this::handleConnectionError);
   ```



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