Dear All,
I just installed Tomcat 6.0.26 for one of my test machines. Boy, is that a nice release. I believe this is a must-have upgrade.
Reviewing the server.xml reveals this little gem:
Code:
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
This is a listener that helps developers to close their Java API resources properly. Essentially this helps you track down and squash perigean leaks and bizarre redeployment behavior.
Here is what I found in my logs, the first time I started my application in the new, instrumented Tomcat:
Code:
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [Timer-0] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [sample saver] but has failed to stop it. This is very likely to create a memory leak.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [dead host notifier] but has failed to stop it. This is very likely to create a memory leak.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [returned host notifier] but has failed to stop it. This is very likely to create a memory leak.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [ActiveMQ Scheduler] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [TcpSocketClose: java.util.concurrent.ThreadPoolExecutor$Worker@54eb840f] but has failed to stop it. This is very likely to create a memory leak.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] but has failed to stop it. This is very likely to create a memory leak.
Apr 8, 2010 7:24:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Persistence Adaptor Task] but has failed to stop it. This is very likely to create a memory leak.
Wow, and I thought I was pretty good at closing all of my resources. This basically tells me that I forget to clean up most of what I used. Hat off to the Tomcat team for adding this feature. Good work guys.
I am off to track down the source of these warnings. Looks like I have some cleaning up to do.
Kees Jan