You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Sanka, Ambica" <AS...@ATPCO.NET> on 2016/05/20 13:21:23 UTC

memory leak in Tomcat 8.0.9

Support Team,

We have been using Tomcat 8.0.9 for our applications. We noticed below memo= ry leak error and out tomcat could not stopped. We had to kill the process = manually. I was reading articles in the internet and this got address after=  tomcat 6. But we found error in higher versions. We are not sure where to = fix this? Below is the error we are getting

2016-05-19 14:03:31,161 [localhost-startStop-2] WARN  org.apache.catalina.l=

oader.WebappClassLoader- The web application [/fmDirectoryService] appears = to have started a thread named [Thread-6] but has failed to stop it. This i= s very likely to create a memory leak. Stack trace of thread:

java.lang.Thread.sleep(Native Method)

net.atpco.cluster.support.BaseLocator$AdminTask.run(BaseLocator.java:141)

2016-05-19 14:03:31,197 [localhost-startStop-2] INFO  org.apache.catalina.c=

ore.ContainerBase.[Catalina].[localhost].[/fmbootstrap]- Destroying Spring = FrameworkServlet 'dispatcherServlet'

2016-05-19 14:03:31,210 [localhost-startStop-2] INFO  org.apache.catalina.c=

ore.ContainerBase.[Catalina].[localhost].[/fmbootstrap]- Closing Spring roo= t WebApplicationContext

2016-05-19 14:03:31,210 [localhost-startStop-2] INFO  org.springframework.b=

oot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext- Closing=  org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebAppli=

cationContext@5e119034<mailto:org.springframework.boot.context.embedded.Ann<mailto:cationContext@5e119034%3cmailto:org.springframework.boot.context.embedded.Ann>=

otationConfigEmbeddedWebApplicationContext@5e119034>: startup date [Thu May=

19 08:17:39 EDT 2016]; root of context hierarchy May 19, 2016 2:03:31 PM com.mongodb.util.management.jmx.JMXMBeanServer unre= gisterMBean

WARNING: Unable to register MBean org.mongodb.driver:type=3DConnectionPool,=

clusterId=3D1,host=3Dlocalhost,port=3D27017

javax.management.InstanceNotFoundException: org.mongodb.driver:type=3DConne=

ctionPool,clusterId=3D1,host=3Dlocalhost,port=3D27017

        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(D=

efaultMBeanServerInterceptor.java:1095)

        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveU=

nregisterMBean(DefaultMBeanServerInterceptor.java:427)

        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregister=

MBean(DefaultMBeanServerInterceptor.java:415)

        at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanS=

erver.java:546)

        at com.mongodb.util.management.jmx.JMXMBeanServer.unregisterMBean(J=

MXMBeanServer.java:52)

        at com.mongodb.JMXConnectionPoolListener.connectionPoolClosed(JMXCo=

nnectionPoolListener.java:68)

        at com.mongodb.PooledConnectionProvider.close(PooledConnectionProvi=

der.java:107)



Any kind of help is appreciated.

Thanks

Ambica.


Re: memory leak in Tomcat 8.0.9

Posted by Mark Thomas <ma...@apache.org>.
On 20/05/2016 20:07, Sanka, Ambica wrote:
> Hi Mark,
> Thanks for your response. Doesn't tomcat stop take care of shutting down all the threads?

No. Read the Javadoc for Thread.stop() to find out why.

> Do we need to handle explicity this case?

Always.

Mark


> Thanks
> Ambica.
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org] 
> Sent: Friday, May 20, 2016 9:34 AM
> To: Tomcat Users List <us...@tomcat.apache.org>
> Subject: Re: memory leak in Tomcat 8.0.9
> 
> First of all, the subject is wrong. There is no memory leak in Tomcat.
> There is a memory leak in the application you are running on Tomcat.
> 
> On 20/05/2016 14:21, Sanka, Ambica wrote:
>> 2016-05-19 14:03:31,161 [localhost-startStop-2] WARN  org.apache.catalina.loader.WebappClassLoader- The web application [/fmDirectoryService] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
>>
>> java.lang.Thread.sleep(Native Method)
>>
>> net.atpco.cluster.support.BaseLocator$AdminTask.run(BaseLocator.java:1
>> 41)
> 
> What isn't clear in the message above?
> 
> Based on the Java package name and your e-mail address net.atpco.cluster.support.BaseLocator is code that you control.
> BaseLocator starts a thread so it needs to stop that thread when the web application shuts down. ServletContextListener.contextDestroyed() is usually where such clean-up is performed.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: memory leak in Tomcat 8.0.9

Posted by "Sanka, Ambica" <AS...@ATPCO.NET>.
Hi Mark,
Thanks for your response. Doesn't tomcat stop take care of shutting down all the threads? Do we need to handle explicity this case?
Thanks
Ambica.

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Friday, May 20, 2016 9:34 AM
To: Tomcat Users List <us...@tomcat.apache.org>
Subject: Re: memory leak in Tomcat 8.0.9

First of all, the subject is wrong. There is no memory leak in Tomcat.
There is a memory leak in the application you are running on Tomcat.

On 20/05/2016 14:21, Sanka, Ambica wrote:
> 2016-05-19 14:03:31,161 [localhost-startStop-2] WARN  org.apache.catalina.loader.WebappClassLoader- The web application [/fmDirectoryService] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
> 
> java.lang.Thread.sleep(Native Method)
> 
> net.atpco.cluster.support.BaseLocator$AdminTask.run(BaseLocator.java:1
> 41)

What isn't clear in the message above?

Based on the Java package name and your e-mail address net.atpco.cluster.support.BaseLocator is code that you control.
BaseLocator starts a thread so it needs to stop that thread when the web application shuts down. ServletContextListener.contextDestroyed() is usually where such clean-up is performed.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: memory leak in Tomcat 8.0.9

Posted by Mark Thomas <ma...@apache.org>.
First of all, the subject is wrong. There is no memory leak in Tomcat.
There is a memory leak in the application you are running on Tomcat.

On 20/05/2016 14:21, Sanka, Ambica wrote:
> 2016-05-19 14:03:31,161 [localhost-startStop-2] WARN  org.apache.catalina.loader.WebappClassLoader- The web application [/fmDirectoryService] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
> 
> java.lang.Thread.sleep(Native Method)
> 
> net.atpco.cluster.support.BaseLocator$AdminTask.run(BaseLocator.java:141)

What isn't clear in the message above?

Based on the Java package name and your e-mail address
net.atpco.cluster.support.BaseLocator is code that you control.
BaseLocator starts a thread so it needs to stop that thread when the web
application shuts down. ServletContextListener.contextDestroyed() is
usually where such clean-up is performed.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org