Hi, fwiw, the "close" method was added in HBaseAdmin for HBase 0.90.5.
N. On Thu, Apr 19, 2012 at 8:09 AM, Eason Lee <[email protected]> wrote: > I don't think this issue can resovle the problem > ZKWatcher is removed,but the configuration and HConnectionImplementation > objects are still in HConnectionManager > this may still cause memery leak > > but calling HConnectionManager.**deleteConnection may resolve HBASE-5073 > problem. > I can see > > if (this.zooKeeper != null) { > LOG.info("Closed zookeeper sessionid=0x" + > Long.toHexString(this.**zooKeeper.getZooKeeper().** > getSessionId())); > this.zooKeeper.close(); > this.zooKeeper = null; > } > > in HConnectionImplementation.**close which is called by > HConnectionManager.**deleteConnection > > > > > Hi Lee >> >> Is HBASE-5073 resolved in that release? >> >> Regards >> Ram >> >> -----Original Message----- >>> From: Eason Lee [mailto:[email protected]] >>> Sent: Thursday, April 19, 2012 10:40 AM >>> To: [email protected] >>> Subject: Re: HBaseAdmin needs a close methord >>> >>> I am using cloudera's cdh3u3 >>> >>>> Hi Lee >>>> >>>> Which version of HBase are you using? >>>> >>>> Regards >>>> Ram >>>> >>>> -----Original Message----- >>>>> From: Eason Lee [mailto:[email protected]] >>>>> Sent: Thursday, April 19, 2012 9:36 AM >>>>> To: [email protected] >>>>> Subject: HBaseAdmin needs a close methord >>>>> >>>>> Resently, my app meets a problem list as follows >>>>> >>>>> Can't construct instance of class >>>>> org/apache/hadoop/hbase/**client/HBaseAdmin >>>>> Exception in thread "Thread-2" java.lang.OutOfMemoryError: unable to >>>>> create new native thread >>>>> at java.lang.Thread.start0(Native Method) >>>>> at java.lang.Thread.start(Thread.**java:640) >>>>> at org.apache.zookeeper.**ClientCnxn.start(ClientCnxn.**java:414) >>>>> at org.apache.zookeeper.**ZooKeeper.<init>(ZooKeeper.**java:378) >>>>> at org.apache.hadoop.hbase.**zookeeper.ZKUtil.connect(** >>>>> ZKUtil.java:97) >>>>> at >>>>> >>>>> org.apache.hadoop.hbase.**zookeeper.ZooKeeperWatcher.<** >>> init>(ZooKeeperWatc >>> >>>> her.java:119) >>>>> at >>>>> >>>>> org.apache.hadoop.hbase.**client.HConnectionManager$** >>> HConnectionImplementa >>> >>>> tion.getZooKeeperWatcher(**HConnectionManager.java:1002) >>>>> at >>>>> >>>>> org.apache.hadoop.hbase.**client.HConnectionManager$** >>> HConnectionImplementa >>> >>>> tion.setupZookeeperTrackers(**HConnectionManager.java:304) >>>>> at >>>>> >>>>> org.apache.hadoop.hbase.**client.HConnectionManager$** >>> HConnectionImplementa >>> >>>> tion.<init>(**HConnectionManager.java:295) >>>>> at >>>>> >>>>> org.apache.hadoop.hbase.**client.HConnectionManager.** >>> getConnection(HConnec >>> >>>> tionManager.java:157) >>>>> at >>>>> >>>> org.apache.hadoop.hbase.**client.HBaseAdmin.<init>(** >>> HBaseAdmin.java:90) >>> >>>> Call to org.apache.hadoop.hbase.**HBaseAdmin::HBaseAdmin failed! >>>>> >>>>> My app create HBaseAdmin every 30s,and the threads used by my app >>>>> increases about 1thread/30s.See from the stack, there is only one >>>>> HBaseAdmin in Memory, but lots of Configuration and >>>>> HConnectionImplementation instances. >>>>> >>>>> I can see from the sources, everytime when HBaseAdmin is created, a >>>>> >>>> new >>> >>>> Configuration and HConnectionImplementation is created and added to >>>>> HConnectionManager.HBASE_**INSTANCES.So<http://HConnectionManager.HBASE_INSTANCES.So>they >>>>> are not collected by gc >>>>> >>>> when >>> >>>> HBaseAdmin is collected. >>>>> >>>>> So i think we need to add a close methord to remove the >>>>> Configuration&**HConnectionImplementation from >>>>> HConnectionManager.HBASE_**INSTANCES.Just as follows: >>>>> >>>>> public void close(){ >>>>> HConnectionManager.**deleteConnection(**getConfiguration(), >>>>> true); >>>>> } >>>>> >>>> >>>> >>>> >>>> >> >> >> > >
