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

Thread leak in CoprocessorHost#getTable(TableName) API

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • None
    • None
    • Reviewed

    Description

      There is a thread leak in below method, we are creating a default pool while calling

      @Override
          public HTableInterface getTable(TableName tableName) throws IOException {
            return this.getTable(tableName, HTable.getDefaultExecutor(getConfiguration()));
          }
      

      which will never be shutdown because in HTable, we are setting this.cleanupPoolOnClose to false

       @InterfaceAudience.Private
        public HTable(TableName tableName, final ClusterConnection connection,
            final TableConfiguration tableConfig,
            final RpcRetryingCallerFactory rpcCallerFactory,
            final RpcControllerFactory rpcControllerFactory,
            final ExecutorService pool) throws IOException {
          if (connection == null || connection.isClosed()) {
            throw new IllegalArgumentException("Connection is null or closed.");
          }
          this.tableName = tableName;
          this.cleanupConnectionOnClose = false;
          this.connection = connection;
          this.configuration = connection.getConfiguration();
          this.tableConfiguration = tableConfig;
          this.pool = pool;
          if (pool == null) {
            this.pool = getDefaultExecutor(this.configuration);
            this.cleanupPoolOnClose = true;
          } else {
            this.cleanupPoolOnClose = false;
          }
      

      resulted in pool to stay forever ,which eventually can lead other processes or the same process to starve for a threads.

      Attachments

        1. HBASE-16389.patch
          0.7 kB
          Ankit Singhal

        Activity

          People

            ankit@apache.org Ankit Singhal
            ankit@apache.org Ankit Singhal
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: