hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cuijianwei (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-10396) The constructor of HBaseAdmin may close the shared HConnection
Date Wed, 22 Jan 2014 09:00:35 GMT

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

cuijianwei commented on HBASE-10396:

To alleviate this problem, we might invoke HConnection#close when connecting to Master fail.
However, this won't close the HConnection immediately if the HConnection is sharing by other
threads. Then, the same HConnection will be got in the next retry.

> The constructor of HBaseAdmin may close the shared HConnection 
> ---------------------------------------------------------------
>                 Key: HBASE-10396
>                 URL: https://issues.apache.org/jira/browse/HBASE-10396
>             Project: HBase
>          Issue Type: Bug
>          Components: Admin, Client
>    Affects Versions: 0.94.16
>            Reporter: cuijianwei
> HBaseAdmin has the constructor:
> {code}
>   public HBaseAdmin(Configuration c)
>   throws MasterNotRunningException, ZooKeeperConnectionException {
>     this.conf = HBaseConfiguration.create(c);
>     this.connection = HConnectionManager.getConnection(this.conf);
>     ...
> {code}
> 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:
> {code}
>     while ( true ){
>       try {
>         this.connection.getMaster();
>         return;
>       } catch (MasterNotRunningException mnre) {
>         HConnectionManager.deleteStaleConnection(this.connection);
>         this.connection = HConnectionManager.getConnection(this.conf);
>       }
> {code} 
> 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:
> {code}
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@61bc59aa
> {code}
> 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.

This message was sent by Atlassian JIRA

View raw message