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

The constructor of HBaseAdmin may close the shared HConnection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 0.94.16
    • None
    • Admin, Client
    • None

    Description

      HBaseAdmin has the constructor:

        public HBaseAdmin(Configuration c)
        throws MasterNotRunningException, ZooKeeperConnectionException {
          this.conf = HBaseConfiguration.create(c);
          this.connection = HConnectionManager.getConnection(this.conf);
          ...
      

      As shown in above code, HBaseAdmin will get a cached HConnection or create a new HConnection and use this HConnection to connect to Master. Then, HBaseAdmin will delete the HConnection when connecting to master fail as follows:

          while ( true ){
            try {
              this.connection.getMaster();
              return;
            } catch (MasterNotRunningException mnre) {
              HConnectionManager.deleteStaleConnection(this.connection);
              this.connection = HConnectionManager.getConnection(this.conf);
            }
      

      The above code will invoke HConnectionManager#deleteStaleConnection to delete the HConnection from global HConnection cache. The risk is that the deleted HConnection might be sharing by other threads, such as HTable or HTablePool. Then, these threads which sharing the deleted HConnection will get closed HConnection exception:

      org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@61bc59aa closed
      

      If users use HTablePool, the situation will become worse because closing HTable will only return HTable to HTablePool which won't reduce the reference count of the closed HConnection. Then, the closed HConnection will always be used before clearing HTablePool. In 0.94, some modules such as Rest server are using HTablePool, therefore may suffer from this problem.

      Attachments

        1. HBASE-10396-0.94-v2.patch
          3 kB
          Jianwei Cui
        2. HBASE-10396-0.94-v1.patch
          1 kB
          Jianwei Cui

        Activity

          People

            Unassigned Unassigned
            cuijianwei Jianwei Cui
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: