hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-4167) Potential leak of HTable instances when using HTablePool with PoolType.ThreadLocal
Date Tue, 23 Aug 2011 00:55:29 GMT

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

Hudson commented on HBASE-4167:
-------------------------------

Integrated in HBase-TRUNK #2130 (See [https://builds.apache.org/job/HBase-TRUNK/2130/])
    HBASE-4167  Potential leak of HTable instances when using HTablePool with
               PoolType.ThreadLocal (Karthick Sankarachary)

tedyu : 
Files : 
* /hbase/trunk/CHANGES.txt
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java


> Potential leak of HTable instances when using HTablePool with PoolType.ThreadLocal
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-4167
>                 URL: https://issues.apache.org/jira/browse/HBASE-4167
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>            Reporter: Gary Helmling
>            Assignee: Karthick Sankarachary
>             Fix For: 0.92.0
>
>         Attachments: HBASE-4167.patch
>
>
> (Initially discussed in HBASE-4150)
> In HTablePool, when obtaining a table:
> {code}
> private HTableInterface findOrCreateTable(String tableName) {
>     HTableInterface table = tables.get(tableName);
>     if (table == null) {
>       table = createHTable(tableName);
>     }
>     return table;
>   }
> {code}
> In the case of {{ThreadLocalPool}}, it seems like there's an exposure here between when
the table is created initially and when {{ThreadLocalPool.put()}} is called to set the thread
local variable (on {{PooledHTable.close()}}).
> Potential solution described by Karthick Sankarachary:
> For one thing, we might want to clear the tables variable when the {{HTablePool}} is
closed (as shown below). For another, we should override ThreadLocalPool#get method so that
it removes the resource, otherwise it might end up referencing a HTableInterface that's has
been released.
> {code}
> 1 diff --git a/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java b/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
>       2 index 952a3aa..c198f15 100755
>       3 --- a/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
>       4 +++ b/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
>      13 @@ -309,6 +310,7 @@ public class HTablePool implements Closeable {
>      14      for (String tableName : tables.keySet()) {
>      15        closeTablePool(tableName);
>      16      }
>      17 +    this.tables.clear();
>      18    }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message