tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Braun <>
Subject Leak in Tomcat 7.0.11: a java.util.Timer seems to leave a timerThread in the JVM, and Tomcat says "...has failed to stop it. This is very likely to create a memory leak"
Date Sat, 30 Jul 2011 01:36:35 GMT

I'm using Tomcat 7.0.11 and I'm experiencing a leak problem.
This is what I find in the log:

Jul 29, 2011 7:36:51 PM org.apache.catalina.loader.WebappClassLoader
SEVERE: The web application [/admin] registered the JDBC driver
[com.mysql.jdbc.Driver] but failed to unregister it when the web application
was stopped. To prevent a memory leak, the JDBC Driver has been forcibly
Jul 29, 2011 7:36:51 PM org.apache.catalina.loader.WebappClassLoader
SEVERE: The web application [/admin] appears to have started a thread named
[ParadiseManualzoneTimer] but has failed to stop it. This is very likely to
create a memory leak.
Jul 29, 2011 7:36:55 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/admin] is completed

Regarding the JDBC driver, I understand that the Tomcat mechanism to solve
the leaks is able to unregister it, so for now I want to concentrate in the
other leak, later I will get back to this and find the way to solve it.

Regarding the thread, it belongs to a java.util.Timer. It is a timer that I
create in the contextInitialized() method of my app, and I attach 3 tasks to
it (java.util.TimerTask). These tasks work great during the live of the app.
In the contextDestroyed() method I do this:

        //Cancel tasks
        LinkedList<java.util.TimerTask> tasks=
        Iterator<java.util.TimerTask> taskIterator =tasks.iterator();
        while (taskIterator.hasNext())
            java.util.TimerTask task;

        //Destroy Timer

I think I'm doing the right thing, but it seems that the thread stays in the
JVM. Im using "Yourkit" (a very powerful profiler!) and I clearly see that
How do I solve it? Do I need to kill the thread somehow, or should it die as
soon as I cancel the timer with the timer.cancel() method?

Thanks in advace!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message