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

Race condition when close sock may cause a NPE in sendBuffer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.4.6
    • None
    • None
    • None

    Description

      In NIOServerCnxn.java
      public void close() {
      closeSock();
      ...
      sk.cancel();

      Close sock first, then cancel the channel.

      public void sendBuffer(ByteBuffer bb) {
      if ((sk.interestOps() & SelectionKey.OP_WRITE) == 0) {
      ...
      sock.write(bb);

      Get ops of the channel, then read sock (may be null)

      I have noticed that the 3.5.0-branch has fixed the problem.

      Attachments

        Activity

          People

            Unassigned Unassigned
            fanster.z Jacky007
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: