zookeeper
zookeeper copied to clipboard
ZOOKEEPER-4541 Ephemeral znode owned by closed session visible in 1 of 3 servers
This fixes two bugs in shutdown logic, in the zookeeper server.
- The
SendAckRequestProcessor
may die when attempting to close itsLearner
owner's socket, to signal that something went wrong, if the learner already closed the socket because something (the same thing) went wrong (namely, the leader disconnecting). This is fixed by simply checking for nullity. -
ZooKeeperServer.shutdown(boolean)
is not present in child classes, so many uses here fail to properly shut down child resources, such as theSyncRequestProcessor
. This is fixed by refactoring shutdown for the child classes.
A unit test is also added, that fails when either of the two fixes are not present.
To be precise, it fails only because the SyncRequestProcessor
is never shut down (thread leak), once the first fix is applied; I didn't spend more time looking for other weird failures that may arise from what is obviously a bug anyway.
See ZOOKEEPER-4541 for full details.