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

Gary Helmling commented on HBASE-7685:
--------------------------------------

The connections.remove() change looks safe to me, and seems right.

In the HBASE-2937 diff, I also see the change in 
HBaseClient.Connection#receiveResponse():
{code:java}
         } else {
           Writable value = ReflectionUtils.newInstance(valueClass, conf);
           value.readFields(in);                 // read value
-          call.setValue(value);
+          // it's possible that this call may have been cleaned up due to a RPC
+          // timeout, so check if it still exists before setting the value.
+          if (call != null) {
+            call.setValue(value);
+          }
           calls.remove(id);
         }
{code}

In SecureClient.Connection#receiveResponse() it doesn't look like we're doing 
any null check prior to using call.  I think we might need this change as well.
                
> Closing socket connection can't be removed from SecureClient
> ------------------------------------------------------------
>
>                 Key: HBASE-7685
>                 URL: https://issues.apache.org/jira/browse/HBASE-7685
>             Project: HBase
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 0.94.3
>            Reporter: cuijianwei
>         Attachments: 
> closing_socket_connection_not_removed_in_secure_client.diff
>
>
> We found many IOExceptions naming "Call # not added as the connection # is 
> closing" when using SecureClient to access hbase. From the source code of 
> SecureClient, we found there may be bug in close() method of SecureClient. 
> The following is the current logic in close() method of SecureClient:
> {code}
>       // release the resources
>       // first thing to do;take the connection out of the connection list
>       synchronized (connections) {
>         if (connections.get(remoteId) == this) {
>           connections.remove(remoteId);
>         }
>       }
> {code}
> However, connections are managed by PoolMap; therefore, if more than one 
> connection are created for the same remoteId, the 'if condition' may not be 
> satisfied because the default PoolType is RoundRobin. This could be cause a 
> closing state connection can't be removed from connections, making new calls 
> which use such connections will always throws IOException naming "connection 
> is closing".
> We can use logic from close() method of HBaseClient to resolve the problem:
> {code}
>       // release the resources
>       // first thing to do;take the connection out of the connection list
>       synchronized (connections) {
>         connections.remove(remoteId, this);
>       }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to