Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B556110E51 for ; Wed, 22 Jan 2014 10:07:28 +0000 (UTC) Received: (qmail 77640 invoked by uid 500); 22 Jan 2014 10:07:21 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 77570 invoked by uid 500); 22 Jan 2014 10:07:20 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 77547 invoked by uid 99); 22 Jan 2014 10:07:19 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jan 2014 10:07:19 +0000 Date: Wed, 22 Jan 2014 10:07:19 +0000 (UTC) From: "cuijianwei (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-10396) The constructor of HBaseAdmin may close the shared HConnection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-10396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878481#comment-13878481 ] cuijianwei commented on HBASE-10396: ------------------------------------ Thanks for your comment [~zjushch], I go through the code of HBaseAdmin in trunk. The HConnection will be closed in HBaseAdmin#close so that fixed the problem. The code of HBaseAdmin changed a lot between 0.94 and trunk, will we supply a patch for 0.94 to fix this problem? > 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 closed > {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 (v6.1.5#6160)