You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Lars Hofhansl (JIRA)" <ji...@apache.org> on 2014/07/08 12:07:04 UTC

[jira] [Commented] (HBASE-11479) SecureConnection can't be closed when SecureClient is stopping because InterruptedException won't be caught in SecureClient#setupIOstreams()

    [ https://issues.apache.org/jira/browse/HBASE-11479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14054793#comment-14054793 ] 

Lars Hofhansl commented on HBASE-11479:
---------------------------------------

lgtm
[~apurtell], what do you think?

> SecureConnection can't be closed when SecureClient is stopping because InterruptedException won't be caught in SecureClient#setupIOstreams()
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-11479
>                 URL: https://issues.apache.org/jira/browse/HBASE-11479
>             Project: HBase
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 0.94.20
>            Reporter: cuijianwei
>            Priority: Minor
>         Attachments: HBASE-11479-0.94-v1.patch
>
>
> 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():
> {code}
> ...
> 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;
>       }
> ...
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)