1. ZooKeeper
  2. ZOOKEEPER-1144

ZooKeeperServer not starting on leader due to a race condition


    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.4.0
    • Fix Version/s: 3.4.0
    • Component/s: None
    • Labels:


      I have found one problem that is causing QuorumPeerMainTest:testQuorum to fail. This test uses 2 ZK servers.

      The test is failing because leader is not starting ZooKeeperServer after leader election. so everything halts.

      With the new changes, the server is now started in Leader.processAck() which is called from LeaderHandler. processAck() starts ZooKeeperServer if majority have acked NEWLEADER. The leader puts its ack in the the ackSet in Leader.lead(). Since processAck() is called from LearnerHandler it can happen that the learner's ack is processed before the leader is able to put its ack in the ackSet. When LearnerHandler invokes processAck(), the ackSet for newLeaderProposal will not have quorum (in this case 2). As a result, the ZooKeeperServer is never started on the Leader.

      The leader needs to ensure that its ack is put in ackSet before starting LearnerCnxAcceptor or invoke processAck() itself after adding to ackSet. I haven't had time to go through the ZAB2 changes so I am not too familiar with the code. Can Ben/Flavio fix this?

        Issue Links


          Vishal Kher created issue -
          Eugene Koontz made changes -
          Field Original Value New Value
          Link This issue is related to ZOOKEEPER-1145 [ ZOOKEEPER-1145 ]
          Vishal Kher made changes -
          Link This issue is related to ZOOKEEPER-1125 [ ZOOKEEPER-1125 ]
          Vishal Kher made changes -
          Attachment ZOOKEEPER-1144.patch [ 12489635 ]
          Vishal Kher made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Assignee Vishal Kher [ vishalmlst ]
          Camille Fournier made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Mahadev konar made changes -
          Status Resolved [ 5 ] Closed [ 6 ]


            • Assignee:
              Vishal Kher
              Vishal Kher
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: