Github user tumativ commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/689#discussion_r231718078
  
    --- Diff: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatcherCleaner.java
 ---
    @@ -50,6 +50,8 @@
     
         private volatile boolean stopped = false;
         private final Object cleanEvent = new Object();
    +    private final Object produserAndConsumerLock = new Object();
    --- End diff --
    
    The producer of the dead watcher is trying to get the lock on 
totalDeadWatchers when totalDeadWatchers reaches the maximum. The expectation 
is the consumer needs to reduce this count .totalDeadWatchers is AtomicInteger 
and getting a lock  on AtomicInteger is a not a good idea as it has their own 
concurrency control mechanisms. It will basically confuse why the lock is 
required on totalDeadWatchers at producer level when we are expecting consumer 
should reduce this count and  it has their own concurrency control mechanisms


---

Reply via email to