Github user timothyjward commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/529#discussion_r196119877
--- Diff: src/java/main/org/apache/zookeeper/ClientCnxn.java ---
@@ -1438,6 +1436,11 @@ public void disconnect() {
}
sendThread.close();
+ try {
+ sendThread.join();
+ } catch (InterruptedException ex) {
+ LOG.warn("Got interrupted while waiting for the sender thread
to close", ex);
+ }
eventThread.queueEventOfDeath();
--- End diff --
If the `queueEventOfDeath` call moves above the `join` call then some
events can be missed.
Specifically closing the connection's eventOfDeath can be processed before
completing the send of the session disconnection message triggered in
disconnect.
I tried moving the queueEventOfDeath above the join, but then some of the
core tests began failing intermittently. This was remedied by moving the
eventOfDeath back after the completion of the send thread.
---