I’m getting exceptions about threads being started and not ending or being stopped. The WebappClassLoader complains that these threads will cause a memory leak.
What is happening here?
- Is it likely such threads will cause a memory leak? Or just possible?
- Is Catalina being overly sensitive?
- Is this even a valid programming technique?
(Managing this aspect of a Tomcat application is new to me. But I have to learn it as the webapp is running out of database connections under high load and this needs to be solved. Searching for memory leaks is one of a number of things we’re looking into.)
You can read about tricky memory leak issues in Tomcat (and this warning in particular) at http://wiki.apache.org/tomcat/MemoryLeakProtection — in particular, for the warning you see:
The impact of this (in my experience) is limited when you start your web application once, and then simply tear it down. However, in some cases, such as in a continuous integration scenario (where your CI server is repeatedly deploying builds of your application into a Tomcat container that is not restarted), you can quickly run out of memory in the JVM. This will eventually manifest itself as an
OutOfMemoryExceptionin your PermGen region (assuming you are using the Sun/Oracle JVM). For more details on PermGen, see http://blogs.oracle.com/fkieviet/entry/classloader_leaks_the_dreaded_java