Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 654A99C0A for ; Tue, 24 Jan 2012 21:35:21 +0000 (UTC) Received: (qmail 72364 invoked by uid 500); 24 Jan 2012 21:35:19 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 72285 invoked by uid 500); 24 Jan 2012 21:35:19 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 72277 invoked by uid 99); 24 Jan 2012 21:35:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2012 21:35:18 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.214.169] (HELO mail-tul01m020-f169.google.com) (209.85.214.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2012 21:35:10 +0000 Received: by obbta7 with SMTP id ta7so6639373obb.14 for ; Tue, 24 Jan 2012 13:34:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.74.97 with SMTP id s1mr13355038obv.42.1327440889566; Tue, 24 Jan 2012 13:34:49 -0800 (PST) Received: by 10.60.11.198 with HTTP; Tue, 24 Jan 2012 13:34:49 -0800 (PST) X-Originating-IP: [68.40.186.90] In-Reply-To: References: Date: Tue, 24 Jan 2012 16:34:49 -0500 Message-ID: Subject: Re: Possible ZooKeeper Connection Leak in TableOutputFormat From: Shawn Quinn To: user@hbase.apache.org X-Gm-Message-State: ALoCoQlW0cDlc2l9nNV4gSS/8WXGQSY3ZOWMG1M9FXtH1u0ktOg9CPm9M5DhRw03KRNgyMPNMVZF Content-Type: multipart/alternative; boundary=f46d04447ff3aed42f04b74cea89 X-Virus-Checked: Checked by ClamAV on apache.org --f46d04447ff3aed42f04b74cea89 Content-Type: text/plain; charset=ISO-8859-1 Thanks for the quick response Ted. It does look like HBASE-4508 would resolve the issue I'm seeing, so I appreciate the pointer. We're back up and running ok for now with a custom TableOutputFormat (and custom TableInputFormat) to work around this issue, but when we're ready to move to a later version of HBase we'll give that new mechanism a try. Thanks! -Shawn On Tue, Jan 24, 2012 at 2:39 PM, Ted Yu wrote: > Thanks for reporting this, Shawn. > > Do you want to try out HBASE-4508 which is in HBase 0.90.5 ? > > On Tue, Jan 24, 2012 at 9:15 AM, Shawn Quinn > wrote: > > > Hello, > > > > Our application runs Map/Reduce tasks fairly frequently against HBase > > (Cloudera distribution 0.90.4), and we're making using of the default > > org.apache.hadoop.hbase.mapreduce.TableOutputFormat class for the reduce > > step which the TableMapReduceUtil.initTableReducerJob() sets up. We > invoke > > the Map/Reduce tasks via the standard Hadoop Job API, but they're all > > triggered from the same virtual machine that stays running (so we aren't > > shutting down the virtual machine after each job runs). We've been > > noticing that we've been running out of ZooKeeper connections in this > > configuration, and believe we've tracked the "leak" down to the > > TableOutputFormat class. Specifically, that class does the following: > > > > public void setConf(Configuration otherConf) { > > this.conf = HBaseConfiguration.create(otherConf); > > String tableName = this.conf.get(OUTPUT_TABLE); > > String address = this.conf.get(QUORUM_ADDRESS); > > String serverClass = this.conf.get(REGION_SERVER_CLASS); > > String serverImpl = this.conf.get(REGION_SERVER_IMPL); > > try { > > if (address != null) { > > ZKUtil.applyClusterKeyToConf(this.conf, address); > > } > > if (serverClass != null) { > > this.conf.set(HConstants.REGION_SERVER_CLASS, serverClass); > > this.conf.set(HConstants.REGION_SERVER_IMPL, serverImpl); > > } > > this.table = new HTable(this.conf, tableName); > > this.table.setAutoFlush(false); > > LOG.info("Created table instance for " + tableName); > > } catch(IOException e) { > > LOG.error(e); > > } > > } > > > > I believe in previous releases of HBase this was different, but at some > > point the code to clone the configuration object (first line of that > > method) was added. Then, in that same method when that code creates the > > HTable instance, internally the HTable gets a new connection to ZooKeeper > > everytime (since the configuration instance is different.) > > > > I believe I can get around this in my application by creating a custom > > TableOutputFormat. However, can anyone confirm if this is indeed a > > problem, or if there is some other way to work around the default > > TableOutputFormat class creating a new connection to ZooKeeper every time > > it runs? > > > > Thanks, > > > > -Shawn > > > --f46d04447ff3aed42f04b74cea89--