You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Krystian Nowak (Created) (JIRA)" <ji...@apache.org> on 2012/01/26 21:57:40 UTC

[jira] [Created] (HBASE-5289) NullPointerException in resetZooKeeperTrackers in HConnectionManager / HConnectionImplementation

NullPointerException in resetZooKeeperTrackers in HConnectionManager / HConnectionImplementation
------------------------------------------------------------------------------------------------

                 Key: HBASE-5289
                 URL: https://issues.apache.org/jira/browse/HBASE-5289
             Project: HBase
          Issue Type: Bug
          Components: client
    Affects Versions: 0.90.5
            Reporter: Krystian Nowak


This might happen on heavy load in case of lagging HBase when sharing one HConnection by multiple threads:

{noformat}
2012-01-26 13:59:38,396 ERROR [http://*:8080-251-EventThread] zookeeper.ClientCnxn$EventThread(532): Error while calling watcher
java.lang.NullPointerException
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.resetZooKeeperTrackers(HConnectionManager.java:533)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.abort(HConnectionManager.java:1536)
        at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.connectionEvent(ZooKeeperWatcher.java:344)
        at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:262)
        at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
        at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:506)
{noformat}

The following code is not protected against NPE:

{code}
    private synchronized void resetZooKeeperTrackers()
        throws ZooKeeperConnectionException {
      LOG.info("Trying to reconnect to zookeeper");
      masterAddressTracker.stop();
      masterAddressTracker = null;
      rootRegionTracker.stop();
      rootRegionTracker = null;
      clusterId = null;
      this.zooKeeper = null;
      setupZookeeperTrackers();
    }
{code}

In some cases as proven by the log snippet above it might happen that either masterAddressTracker or rootRegionTracker might be null.
Because of the NPE the code can't reach setupZookeeperTrackers() call.

This should be fixed at least the way as shown in one of the patches in HBASE-5153

{code}
      LOG.info("Trying to reconnect to zookeeper.");
      if (this.masterAddressTracker != null) {
        this.masterAddressTracker.stop();
        this.masterAddressTracker = null;
      }
      if (this.rootRegionTracker != null) {
        this.rootRegionTracker.stop();
        this.rootRegionTracker = null;
      }
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5289) NullPointerException in resetZooKeeperTrackers in HConnectionManager / HConnectionImplementation

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194175#comment-13194175 ] 

Zhihong Yu commented on HBASE-5289:
-----------------------------------

Thanks for reporting this case, Krystian.

Do you want to upload a patch ?

                
> NullPointerException in resetZooKeeperTrackers in HConnectionManager / HConnectionImplementation
> ------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-5289
>                 URL: https://issues.apache.org/jira/browse/HBASE-5289
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.90.5
>            Reporter: Krystian Nowak
>             Fix For: 0.94.0, 0.92.1
>
>
> This might happen on heavy load in case of lagging HBase when sharing one HConnection by multiple threads:
> {noformat}
> 2012-01-26 13:59:38,396 ERROR [http://*:8080-251-EventThread] zookeeper.ClientCnxn$EventThread(532): Error while calling watcher
> java.lang.NullPointerException
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.resetZooKeeperTrackers(HConnectionManager.java:533)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.abort(HConnectionManager.java:1536)
>         at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.connectionEvent(ZooKeeperWatcher.java:344)
>         at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:262)
>         at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:506)
> {noformat}
> The following code is not protected against NPE:
> {code}
>     private synchronized void resetZooKeeperTrackers()
>         throws ZooKeeperConnectionException {
>       LOG.info("Trying to reconnect to zookeeper");
>       masterAddressTracker.stop();
>       masterAddressTracker = null;
>       rootRegionTracker.stop();
>       rootRegionTracker = null;
>       clusterId = null;
>       this.zooKeeper = null;
>       setupZookeeperTrackers();
>     }
> {code}
> In some cases as proven by the log snippet above it might happen that either masterAddressTracker or rootRegionTracker might be null.
> Because of the NPE the code can't reach setupZookeeperTrackers() call.
> This should be fixed at least the way as shown in one of the patches in HBASE-5153
> {code}
>       LOG.info("Trying to reconnect to zookeeper.");
>       if (this.masterAddressTracker != null) {
>         this.masterAddressTracker.stop();
>         this.masterAddressTracker = null;
>       }
>       if (this.rootRegionTracker != null) {
>         this.rootRegionTracker.stop();
>         this.rootRegionTracker = null;
>       }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5289) NullPointerException in resetZooKeeperTrackers in HConnectionManager / HConnectionImplementation

Posted by "Zhihong Yu (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu updated HBASE-5289:
------------------------------

    Fix Version/s: 0.92.1
                   0.94.0
    
> NullPointerException in resetZooKeeperTrackers in HConnectionManager / HConnectionImplementation
> ------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-5289
>                 URL: https://issues.apache.org/jira/browse/HBASE-5289
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.90.5
>            Reporter: Krystian Nowak
>             Fix For: 0.94.0, 0.92.1
>
>
> This might happen on heavy load in case of lagging HBase when sharing one HConnection by multiple threads:
> {noformat}
> 2012-01-26 13:59:38,396 ERROR [http://*:8080-251-EventThread] zookeeper.ClientCnxn$EventThread(532): Error while calling watcher
> java.lang.NullPointerException
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.resetZooKeeperTrackers(HConnectionManager.java:533)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.abort(HConnectionManager.java:1536)
>         at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.connectionEvent(ZooKeeperWatcher.java:344)
>         at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.process(ZooKeeperWatcher.java:262)
>         at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:506)
> {noformat}
> The following code is not protected against NPE:
> {code}
>     private synchronized void resetZooKeeperTrackers()
>         throws ZooKeeperConnectionException {
>       LOG.info("Trying to reconnect to zookeeper");
>       masterAddressTracker.stop();
>       masterAddressTracker = null;
>       rootRegionTracker.stop();
>       rootRegionTracker = null;
>       clusterId = null;
>       this.zooKeeper = null;
>       setupZookeeperTrackers();
>     }
> {code}
> In some cases as proven by the log snippet above it might happen that either masterAddressTracker or rootRegionTracker might be null.
> Because of the NPE the code can't reach setupZookeeperTrackers() call.
> This should be fixed at least the way as shown in one of the patches in HBASE-5153
> {code}
>       LOG.info("Trying to reconnect to zookeeper.");
>       if (this.masterAddressTracker != null) {
>         this.masterAddressTracker.stop();
>         this.masterAddressTracker = null;
>       }
>       if (this.rootRegionTracker != null) {
>         this.rootRegionTracker.stop();
>         this.rootRegionTracker = null;
>       }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira