Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-6663

NPE race in HConnection if zookeeper is reset

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.94.1
    • 0.94.2
    • Client
    • None

    Description

      On 0.94, HConnectionImplementation has code like this:

      getZooKeeperWatcher();
      String tableNameStr = Bytes.toString(tableName);
      try {
        if (online) {
          return ZKTable.isEnabledTable(this.zooKeeper, tableNameStr);
        }
        return ZKTable.isDisabledTable(this.zooKeeper, tableNameStr);
      

      The issue is that between the time that getZooKeeperWatcher is called and this.zooKeeper is used, this.zooKeeper can be set to null by another thread via resetZooKeeperTrackers.

      The cleanest solution to me seems to be to cache the value. I have a patch that does this and a test that fails without the patch and passes with it.

      This issue doesn't appear on 0.96 because the zookeeper code has been separated in HBASE-5399.

      Attachments

        1. HBASE-6663.patch
          8 kB
          Gregory Chanan

        Activity

          People

            gchanan Gregory Chanan
            gchanan Gregory Chanan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: