Github user lvfangmin commented on the issue: https://github.com/apache/zookeeper/pull/611 @anmolnar here are some clarifications based on your comments: * #611 is not needed anymore because the issue @wangchaod reported here is due to the 'leaking' watcher entry in watch2Paths after the cnxn is actually closed. And this patch fixed it by removing it from watch2Paths when closing. * NIO is already doing the right job, which will remove itself from watch2Paths when the cnxn is closed. (this patch is actually following what we're doing in NIO). * Leaving an empty watcher entry in watch2paths shouldn't result in inconsistent watches. One thing I can think of which might cause the watch inconsistent is due to the race condition of closing cnxn and the on flying add watch request in pipeline, which should be fixed it in the #590 with the isDeadWatch check.
---