After hitting the jsp once and then reloading the app, I ran Find leaks through the manager application at http://localhost:8080/manager/html and get this:
The following web applications were stopped (reloaded, undeployed), but their classes from previous runs are still loaded in memory, thus causing a memory leak (use a profiler to confirm): /dynam The name of the web app context is dynam. Each time I repeat, I get an extra /dynam line, as expected. Additionally, each time I reload the context catalina.out shows: SEVERE: The web application [/dynam] appears to have started a thread named [IPC Client (1622444498) connection to hb02/192.168.200.102:60020 from tslazar] but has failed to stop it. This is very likely to create a memory leak. Is there a ZooKeeper method I should call to shutdown a thread? I added a finally block though that doesn't change the behavior. On Mon, Mar 3, 2014 at 8:55 PM, Ted Yu <[email protected]> wrote: > bq. Tomcat detects that I may have a memory leak > > Can you show us the warning from Tomcat. > > w.r.t. the snippet you posted: the two close() calls should be enclosed in > finally block. > > > On Mon, Mar 3, 2014 at 1:21 PM, Toby Lazar <[email protected]> wrote: > > > I am working on an HBase webapp and Tomcat is telling me I have a memory > > leak, which I have confirmed, but I'm not sure how to fix it. I've > reduced > > my app to a single jsp that calls a single method (both are included > below > > since they are short). After I reload my application, Tomcat detects > that > > I may have a memory leak, leading me to think I should be doing something > > else when closing an HConnection. I tried the deprecated > > HConnectionManager.deleteConnection(config) without any luck. > > > > I am using Hadoop 2.2/HBase 0.96 client jars and running it on Tomcat > > 7.0.47/JVM 1.7.0_45 on CentOS 6.5. > > > > Any ideas what I'm missing or how to work around this? > > > > Thanks! > > > > Toby > > > > > > > > JSP is: > > > > <%@page import="foobar.Test"%> > > <%@ page language="java" contentType="text/html; charset=UTF-8" > > pageEncoding="UTF-8"%> > > <%out.println(Test.hello()); %> > > > > Java method in the Test class is: > > > > public static String hello() throws IOException{ > > Configuration config = HBaseConfiguration.create(); > > HConnection connection = HConnectionManager.createConnection(config); > > HTableInterface table = connection.getTable("sometable"); > > table.close(); > > connection.close(); > > return "hellosay"; > > } > > > > > > > > ******************************* > > Toby Lazar > > Capital Technology Group > > Email: [email protected] > > Mobile: 646-469-5865 > > ******************************* > > >
