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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:
##########
@@ -63,11 +66,20 @@ protected void grabCnx() {
             return;
         }
 
-        if (!isValidStateForReconnection()) {
-            // Ignore connection closed when we are shutting down
-            log.info("[{}] [{}] Ignoring reconnection request (state: {})",
-                    state.topic, state.getHandlerName(), state.getState());
-            return;
+        synchronized (this) {
+            if (duringConnect) {
+                log.info("[{}] [{}] Skip grabbing the connection since there 
is a pending connection",
+                        state.topic, state.getHandlerName());
+                return;
+            }
+            if (isValidStateForReconnection()) {

Review Comment:
   > After the state is changed to Ready, the consumer will receive messages. 
The next grabCnx will make the received messages lost
   
   This seems another issue existing in the current codebase instead of 
introduced by this patch?



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