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

client connection hung up because of dead loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.0
    • None
    • java client
    • None

    Description

      There is something wrong with the client code ClientCnxn.java, it will keep trying to connect to server in a dead loop.
      This is my test step, shut down zookeeper cluster, exectue zkCli.sh script to connect to zookeeper cluster, it will keep trying to connect to zookeeper server without stop.

      public void run() {
      clientCnxnSocket.introduce(this, sessionId, outgoingQueue);
      clientCnxnSocket.updateNow();
      clientCnxnSocket.updateLastSendAndHeard();
      int to;
      long lastPingRwServer = Time.currentElapsedTime();
      final int MAX_SEND_PING_INTERVAL = 10000; //10 seconds
      while (state.isAlive()) {
      try {
      if (!clientCnxnSocket.isConnected()) {
      // don't re-establish connection if we are closing
      if (closing)

      { break; }

      startConnect();
      clientCnxnSocket.updateLastSendAndHeard();
      }

      public boolean isAlive()

      { return this != CLOSED && this != AUTH_FAILED; }

      because at the beginning it is CONNECTING so isAlive always returns true, which leads to dead loop.
      we should add some retry limit to stop this

      Attachments

        Activity

          People

            Unassigned Unassigned
            haitao-tony sunhaitao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: