Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-3466

ZK cluster converges, but does not properly handle client connections (new in 3.5.5)

Add voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.5
    • None
    • None
    • None
    • Linux

    Description

      Hey, we explore switching from ZooKeeper 3.4.14 to ZooKeeper 3.5.5 in https://github.com/dcos/dcos.

      DC/OS coordinates ZooKeeper via Exhibitor. We are not changing anything w.r.t. Exhibitor for now, and are hoping that we can use ZooKeeper 3.5.5 as a drop-in replacement for 3.4.14. This seems to work fine when Exhibitor uses a so-called static ensemble where the individual ZooKeeper instances are known a priori.

      When Exhibitor however discovers individual ZooKeeper instances ("dynamic" back-end) then I think we observe a regression where ZooKeeper 3.5.5 can get into the following bad state (often, but not always):

      1. three ZooKeeper instances find each other, leader election takes place (expected)
      2. leader election succeeds: two followers, one leader (expected)
      3. all three ZK instances respond IAMOK to RUOK  (expected)
      4. all three ZK instances respond to SRVR (one says "Mode: leader", the other two say "Mode: follower")  (expected)
      5. all three ZK instances respond to MNTR and show plausible output (expected)
      6. Unexpected: any ZooKeeper client trying to connect to any of the three nodes observes a "connection timeout", whereas notably this is not a TCP connect() timeout. The TCP connect() succeeds, but then ZK does not seem to send the expected byte sequence to the TCP connection, and the ZK client waits for it via recv() until it hits a timeout condition. Examples for two different clients:
        1. In Kazoo we specifically hit Connection time-out: socket time-out during read
          generated here: https://github.com/python-zk/kazoo/blob/88b657a0977161f3815657878ba48f82a97a3846/kazoo/protocol/connection.py#L249
        2. In zkCli we see  Client session timed out, have not heard from server in 15003ms for sessionid 0x0, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn:main-SendThread(localhost:2181))
      7. This state is stable, it will last forever (well, at least for multiple hours and we didn't test longer than that).
      8. In our system the ZooKeeper clients are crash-looping. They retry. What I have observed is that while they retry the ZK ensemble accumulates outstanding requests, here shown from MNTR output (emphasis mine): 
        zk_packets_received 2008
        zk_packets_sent 127
        zk_num_alive_connections 18
        zk_outstanding_requests 1880
      9. The leader emits log lines confirming session timeout, example:
        [myid:3] INFO [SessionTracker:ZooKeeperServer@398] - Expiring session 0x2000642b18f0020, timeout of 10000ms exceeded [myid:3] INFO [SessionTracker:QuorumZooKeeperServer@157] - Submitting global closeSession request for session 0x2000642b18f0020
      10. In this state, restarting any one of the two ZK followers results in the same state (clients don't get data from ZK upon connect).
      11. In this state, restarting the ZK leader, and therefore triggering a leader re-election, almost immediately results in all clients being able to connect to all ZK instances successfully.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jgehrcke Jan-Philip Gehrcke

            Dates

              Created:
              Updated:

              Slack

                Issue deployment