diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java index 347a68f80b5..874592e1248 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java @@ -1303,7 +1303,7 @@ public void run() { } } - synchronized (state) { + synchronized (outgoingQueue) { // When it comes to this point, it guarantees that later queued // packet to outgoingQueue will be notified of death. cleanup(); @@ -1671,7 +1671,7 @@ public Packet queuePacket( // 1. synchronize with the final cleanup() in SendThread.run() to avoid race // 2. synchronized against each packet. So if a closeSession packet is added, // later packet will be notified. - synchronized (state) { + synchronized (outgoingQueue) { if (!state.isAlive() || closing) { conLossPacket(packet); } else {