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

SecureConnection can't be closed when SecureClient is stopping because InterruptedException won't be caught in SecureClient#setupIOstreams()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.94.20
    • 0.94.22
    • security
    • None
    • Reviewed

    Description

      When HBaseClient.stop() is invoked, all cached HBaseClient.Connections will be interrupted, marked as closed and then finally closed. HBaseClient.stop() won't return before all cached HBaseClient.Connections have been closed. However, SecureConnection might not be closed after HBaseClient.stop() is invoked because of the following code in SecureClient,setupIOstreams():

      ...
      try {
           ...
                  try {
                    continueSasl =
                      ticket.runAs(new PrivilegedExceptionAction<Boolean>() {
                        @Override
                        public Boolean run() throws IOException {
                          return setupSaslConnection(in2, out2);
                        }
                      });
                  } catch (Exception ex) {
                    if (rand == null) {
                      rand = new Random();
                    }
                    // == InterruptedException won't be caught ==
                    handleSaslConnectionFailure(numRetries++, MAX_RETRIES, ex, rand, ticket);
                    continue;
                    ...
                  }
              }
            } catch (IOException e) {
              markClosed(e);
              close();
      
              throw e;
            }
      
      ...
      

      SecureClient.handleSaslConnectionFailure(...) will throw InterruptedException exception(there will be Thread.sleep() in SecureClient.handleSaslConnectionFailure(...)) when HBaseClient#stop() is invoked. However, this InterruptedException won't be caught, making this SecureConnection can't be closed.

      This problem might make regionserver can't exit because regionserver will wait all SecureConnection closed when exiting. A simple way to fix this bug is to catch InterruptedException in SecureClient#setupIOstreams() and close the SecureConnection.

      Attachments

        1. HBASE-11479-0.94-v1.patch
          0.9 kB
          Jianwei Cui

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: