Topic
  • 2 replies
  • Latest Post - ‏2013-02-07T11:55:29Z by SystemAdmin
SystemAdmin
SystemAdmin
6195 Posts

Pinned topic Tomcat6 memory leaks - how to fix?

‏2013-02-06T08:17:31Z |
We are migrating from Tomcat 5.5 to Tomcat 6.0 (since the former is end-of-life). Tomcat 6.0 reports errors that we did not see in Tomcat 5.5.

Our WebService application reports the following warning

6.2.2013 10:00:44 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/WebServicesTest] created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder] (value [org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@431067af]) and a value of type [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl] (value [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl@6a07348e]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

and our JSF application reports the following warnings

6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/test] registered the JDBC driver [com.ibm.as400.access.AS400JDBCDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/test] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak. 6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/test] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak. 6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/test] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak. 6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/test] appears to have started a thread named [AS400ConnectionPoolMaintenanceThread] but has failed to stop it. This is very likely to create a memory leak. 6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/test] appears to have started a thread named [AS400 Read Daemon-2] but has failed to stop it. This is very likely to create a memory leak. 6.2.2013 10:01:53 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/test] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak.

Is Tomcat 6.0 just better at reporting memory leaks and the problems have just not been reported in Tomcat 5.5? Or is there something we should do differently when deploying to Tomcat 6?

Perhaps related observation is that shutting down Tomcat 6 from the RBD workbench seems to fail way more often than shutting down Tomcat 5.5 did.
Updated on 2013-02-07T11:55:29Z at 2013-02-07T11:55:29Z by SystemAdmin
  • markevans
    markevans
    3025 Posts

    Re: Tomcat6 memory leaks - how to fix?

    ‏2013-02-06T21:39:28Z  
    Tuukka,

    I found this link which lists a new feature of Tomcat 6.0.25 called a memory leak detector tool

    https://confluence.atlassian.com/pages/viewpage.action?pageId=218275753

    and another one from the Tomcat Site:

    http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener

    I have no particular knowledge of this...or it is really an issue. There were several posts when I googled. Some of the messages in the Google search said that the JDBC driver was "forcibly removed".
    Not sure why your message is different, but maybe it is a setting in Tomcat or a part of some later release.

    Either way..I think the messages are a result of Tomcat detecting more than it used it...
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: Tomcat6 memory leaks - how to fix?

    ‏2013-02-07T11:55:29Z  
    • markevans
    • ‏2013-02-06T21:39:28Z
    Tuukka,

    I found this link which lists a new feature of Tomcat 6.0.25 called a memory leak detector tool

    https://confluence.atlassian.com/pages/viewpage.action?pageId=218275753

    and another one from the Tomcat Site:

    http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener

    I have no particular knowledge of this...or it is really an issue. There were several posts when I googled. Some of the messages in the Google search said that the JDBC driver was "forcibly removed".
    Not sure why your message is different, but maybe it is a setting in Tomcat or a part of some later release.

    Either way..I think the messages are a result of Tomcat detecting more than it used it...
    Hello Mark,
    thank you for the links. I am inclined to think as well that the messages are a result of Tomcat detecting more than it used it - in Tomcat 5 successive re-deployments consistently generated PermGen errors. Another possibility is, of course, that this results in from class loading in Tomcat 6 being somewhat different from class loading in Tomcat 5.5. However, I suspect there is little I can do to mitigate these issues - except trying to search for updated jar-files to see if the memeory leak has been fixed in them. At least one of the entries is logged as a bug in JTOpen tracker. JTOpen might be updated but the most likely Axis won't be.

    I'll monitor the situation to see if we get any more serious problems than mere log warnings.