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

Race condition producing NPE in NIOServerCnxn.toString

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.5.0
    • 3.4.6, 3.5.0
    • server
    • None

    Description

      The socket is closed and the variable "sock" is set to null for normal reasons, but the toString method is called before "sock" can be set again, producing a NullPointerException.

      Stack trace:

      2013-08-29 01:49:19,991 6277 [CommitProcWorkThread-3] WARN org.apache.zookeeper.server.WorkerService - Unexpected exception
      java.lang.NullPointerException
      at org.apach.zookeeper.server.NIOServerCnxn.toString(NIOServerCnxn.java:961)
      at java.lang.String.valueOf(String.java:2854)
      at java.lang.StringBuilder.append(StringBuilder.java:128)
      at org.apache.zookeeper.server.NIOServerCnxn.process(NIOServerCnxn.java:1104)
      at org.apache.zookeeper.server.WatchManager.triggerWatch(WatchManager.java:120)
      at org.apache.zookeeper.server.WatchManager.triggerWatch(WatchManager.java:92)
      at org.apache.zookeeper.server.DataTree.createNode(DataTree.java:544)
      at org.apache.zookeeper.server.DataTree.processTxn(DataTree.java:805)
      at org.apache.zookeeper.server.ZKDatabase.processTxn(ZKDatabase.java:319)
      at org.apache.zookeeper.server.ZooKeeperServer.processTxn(ZooKeeperServer.java:967)
      at org.apache.zookeeper.server.FinalRequestProcessor.processRequest(FinalRequestProcessor.java:115)
      at org.apache.zookeeper.server.quorum.Leader$ToBeAppliedRequestProcessor.processRequest(Leader.java:859)
      at org.apache.zookeeper.server.quorum.CommitProcessor$CommitWorkRequest.doWork(CommitProcessor.java:271)
      at org.apache.zookeeper.server.WorkerService$ScheduledWorkRequest.run(WorkerService.java:152)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)

      Attachments

        1. 0004-ZOOKEEPER-1750-trunk-version-modified-test-case-assertion.patch
          2 kB
          Rakesh Radhakrishnan
        2. 0003-ZOOKEEPER-1750-branch-3_4.patch
          5 kB
          Rakesh Radhakrishnan
        3. 0002-ZOOKEEPER-1750-trunk-version.patch
          5 kB
          Rakesh Radhakrishnan
        4. 0001-ZOOKEEPER-1750-trunk-version.patch
          5 kB
          Rakesh Radhakrishnan

        Activity

          People

            rakeshr Rakesh Radhakrishnan
            helen Helen Hastings
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: