You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/02/03 22:39:54 UTC

[GitHub] [zookeeper] hanm commented on a change in pull request #1235: ZOOKEEPER-3706: ZooKeeper.close() would leak SendThread when the netw…

hanm commented on a change in pull request #1235: ZOOKEEPER-3706: ZooKeeper.close() would leak SendThread when the netw…
URL: https://github.com/apache/zookeeper/pull/1235#discussion_r374379920
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
 ##########
 @@ -1121,6 +1125,9 @@ private void startConnect(InetSocketAddress addr) throws IOException {
                     LOG.warn("Unexpected exception", e);
                 }
             }
+            if (!state.isAlive()) {
 
 Review comment:
   I suspect this will not completely fix the race condition between setting the state to closed and connecting. Another thread could set the state to close immediately after this check but before the subsequent `state = States.CONNECTING;` statement. We could make sure that this "check and assign" operation is atomic to completely address the race condition.

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


With regards,
Apache Git Services