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

Not isAlive states should be synchronized in ClientCnxn

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.5.1, 3.6.0
    • java client
    • None

    Description

      In ClientCnxn.queuePacket, it checks variables of state and closing and then make decisions. There is toctou race in queuePacket():

              if (!state.isAlive() || closing) {
                  conLossPacket(packet);
              } else {
                  ...
              }
      

      A possible race:
      in SendThread.run():

        while (state.isAlive()) {
          ...
        }
        cleanup();
      

      When it checks in queuePacket(), state is still alive. Then state isn't alive, SendThread.run() cleans up outgoingQueue. Then queuePacket adds packet to outgoingQueue. The packet should be waken up with exception. But it won't at this case.

      Attachments

        1. ZOOKEEPER-2111.patch
          5 kB
          Hongchao Deng
        2. ZOOKEEPER-2111.patch
          11 kB
          Hongchao Deng
        3. ZOOKEEPER-2111.patch
          2 kB
          Hongchao Deng
        4. ZOOKEEPER-2111.patch
          2 kB
          Rakesh Radhakrishnan

        Issue Links

          Activity

            People

              hdeng Hongchao Deng
              hdeng Hongchao Deng
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: