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 DEDC2723C for ; Wed, 23 Nov 2011 21:21:04 +0000 (UTC) Received: (qmail 12139 invoked by uid 500); 23 Nov 2011 21:21:04 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 12104 invoked by uid 500); 23 Nov 2011 21:21:04 -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 12096 invoked by uid 99); 23 Nov 2011 21:21:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 21:21:04 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 21:21:02 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 636519A2CD for ; Wed, 23 Nov 2011 21:20:41 +0000 (UTC) Date: Wed, 23 Nov 2011 21:20:41 +0000 (UTC) From: "Terry Siu (Commented) (JIRA)" To: issues@hbase.apache.org Message-ID: <51835352.7342.1322083241409.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <597269077.62294.1302955746082.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HBASE-3792) TableInputFormat leaks ZK connections MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HBASE-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13156289#comment-13156289 ] Terry Siu commented on HBASE-3792: ---------------------------------- Thanks, Bryan, looking forward to getting the 0.90.4 patch. > TableInputFormat leaks ZK connections > ------------------------------------- > > Key: HBASE-3792 > URL: https://issues.apache.org/jira/browse/HBASE-3792 > Project: HBase > Issue Type: Bug > Components: mapreduce > Affects Versions: 0.90.1 > Environment: Java 1.6.0_24, Mac OS X 10.6.7 > Reporter: Bryan Keller > Attachments: tableinput.patch > > > The TableInputFormat creates an HTable using a new Configuration object, and it never cleans it up. When running a Mapper, the TableInputFormat is instantiated and the ZK connection is created. While this connection is not explicitly cleaned up, the Mapper process eventually exits and thus the connection is closed. Ideally the TableRecordReader would close the connection in its close() method rather than relying on the process to die for connection cleanup. This is fairly easy to implement by overriding TableRecordReader, and also overriding TableInputFormat to specify the new record reader. > The leak occurs when the JobClient is initializing and needs to retrieves the splits. To get the splits, it instantiates a TableInputFormat. Doing so creates a ZK connection that is never cleaned up. Unlike the mapper, however, my job client process does not die. Thus the ZK connections accumulate. > I was able to fix the problem by writing my own TableInputFormat that does not initialize the HTable in the getConf() method and does not have an HTable member variable. Rather, it has a variable for the table name. The HTable is instantiated where needed and then cleaned up. For example, in the getSplits() method, I create the HTable, then close the connection once the splits are retrieved. I also create the HTable when creating the record reader, and I have a record reader that closes the connection when done. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira