ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1875

NullPointerException in ClientCnxn$EventThread.processEvent

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.5
    • Fix Version/s: 3.5.0
    • Component/s: java client
    • Labels:
      None

      Description

      We've been seeing NullPointerException while working on HBase:

      14/01/30 22:15:25 INFO zookeeper.ZooKeeper: Client environment:user.dir=/home/biadmin/hbase-trunk
      14/01/30 22:15:25 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=hdtest009:2181 sessionTimeout=90000 watcher=null
      14/01/30 22:15:25 INFO zookeeper.ClientCnxn: Opening socket connection to server hdtest009/9.30.194.18:2181. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
      14/01/30 22:15:25 INFO zookeeper.ClientCnxn: Socket connection established to hdtest009/9.30.194.18:2181, initiating session
      14/01/30 22:15:25 INFO zookeeper.ClientCnxn: Session establishment complete on server hdtest009/9.30.194.18:2181, sessionid = 0x143986213e67e48, negotiated timeout = 60000
      14/01/30 22:15:25 ERROR zookeeper.ClientCnxn: Error while calling watcher
      java.lang.NullPointerException
              at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:519)
              at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:495)
      

      The reason is the watcher is null in this part of the code:

             private void processEvent(Object event) {
                try {
                    if (event instanceof WatcherSetEventPair) {
                        // each watcher will process the event
                        WatcherSetEventPair pair = (WatcherSetEventPair) event;
                        for (Watcher watcher : pair.watchers) {
                            try {
                                watcher.process(pair.event);
                            } catch (Throwable t) {
                                LOG.error("Error while calling watcher ", t);
                            }
                        }
      

        Activity

        Jerry He created issue -
        Jerry He made changes -
        Field Original Value New Value
        Attachment ZOOKEEPER-1875.patch [ 12626596 ]
        Jerry He made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Jerry He added a comment -

        Attached a patch that does the null checking for watcher.

        Show
        Jerry He added a comment - Attached a patch that does the null checking for watcher.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12626596/ZOOKEEPER-1875.patch
        against trunk revision 1561672.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        -1 patch. The patch command could not apply the patch.

        Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1915//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12626596/ZOOKEEPER-1875.patch against trunk revision 1561672. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. -1 patch. The patch command could not apply the patch. Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1915//console This message is automatically generated.
        Jerry He made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Jerry He made changes -
        Attachment ZOOKEEPER-1875.patch [ 12626596 ]
        Jerry He made changes -
        Attachment ZOOKEEPER-1875-trunk.patch [ 12626598 ]
        Jerry He made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Jerry He added a comment -

        The patch was generated based on trunk. I am not sure why it can not be applied.
        Re-submitting ...

        Show
        Jerry He added a comment - The patch was generated based on trunk. I am not sure why it can not be applied. Re-submitting ...
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12626598/ZOOKEEPER-1875-trunk.patch
        against trunk revision 1561672.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        -1 patch. The patch command could not apply the patch.

        Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1916//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12626598/ZOOKEEPER-1875-trunk.patch against trunk revision 1561672. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. -1 patch. The patch command could not apply the patch. Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1916//console This message is automatically generated.
        Hide
        Jerry He added a comment -

        Can someone look to see why the patch can not apply on the build server?
        I can apply fine locally.

        Also regarding the NPE, it can be easily re-created when you instantiate a zookeeper class with null watcher.

        Show
        Jerry He added a comment - Can someone look to see why the patch can not apply on the build server? I can apply fine locally. Also regarding the NPE, it can be easily re-created when you instantiate a zookeeper class with null watcher.
        Hide
        Thawan Kooburat added a comment -

        Patch need to be in svn format

        Show
        Thawan Kooburat added a comment - Patch need to be in svn format
        Jerry He made changes -
        Attachment ZOOKEEPER-1875-trunk.patch [ 12626598 ]
        Jerry He made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Jerry He made changes -
        Attachment ZOOKEEPER-1875-trunk.patch [ 12627002 ]
        Jerry He made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Jerry He added a comment -

        Thanks, Thawan.
        Attached a re-formatted patch. Hope it will work this time.

        Show
        Jerry He added a comment - Thanks, Thawan. Attached a re-formatted patch. Hope it will work this time.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12627002/ZOOKEEPER-1875-trunk.patch
        against trunk revision 1561672.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        -1 core tests. The patch failed core unit tests.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1917//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1917//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1917//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12627002/ZOOKEEPER-1875-trunk.patch against trunk revision 1561672. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1917//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1917//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/1917//console This message is automatically generated.
        Hide
        stack added a comment -

        +1

        Show
        stack added a comment - +1
        Hide
        Jerry He added a comment -

        Hi,

        Are we good with the patch?

        Show
        Jerry He added a comment - Hi, Are we good with the patch?
        Hide
        Camille Fournier added a comment -

        No easy test possible?

        Show
        Camille Fournier added a comment - No easy test possible?
        Hide
        Jerry He added a comment -

        Hi, Camille

        Are you asking for a unit test case?
        Can you give a pointer or suggestion to a test case I can follow or add to?

        Show
        Jerry He added a comment - Hi, Camille Are you asking for a unit test case? Can you give a pointer or suggestion to a test case I can follow or add to?
        Patrick Hunt made changes -
        Assignee Jerry He [ jerryhe ]
        Hide
        Michi Mutsuzaki added a comment -

        Yes, it would be good to add a test case. I would add a new test file ClientCnxnTest.java under trunk/src/java/test/org/apache/zookeeper/test. Just as one example, SessionTest.java starts a server and tests the client against the server.

        Show
        Michi Mutsuzaki added a comment - Yes, it would be good to add a test case. I would add a new test file ClientCnxnTest.java under trunk/src/java/test/org/apache/zookeeper/test. Just as one example, SessionTest.java starts a server and tests the client against the server.
        Michi Mutsuzaki made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]

          People

          • Assignee:
            Jerry He
            Reporter:
            Jerry He
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development