On 21/03/2012 00:40, Dale Ogilvie wrote: > In our webapps running on Tomcat 7 we have seen quite a number of > classloader memory leaks. The end result is that after a number of > application reloads and redeploys, we run out of permanent generation > memory and Tomcat stops responding. We can see the evidence of this sort > of issue thanks to the new memory leak reporting in TC6+
Glad to see that the memory leak reporting is doing its job. > Generally we can trace this back to service semantics library code, > ActiveMQ, Quartz, etc. I spent a fair bit of time hunting out these sort > of issues, squashing some of them by explicitly calling specific > finalization routines in each library, on context closure. > > My question is, why is it that we have to be bothered by this > show-stopper memory leak? When the application is unloaded by Tomcat, it > should go away completely, regardless of (for example) unstopped threads > in library foo. Because there is no safe API available to stop a running thread. > My semi-rant is inspired by the following recent comment by Mladen Turk. Your rant would be better aimed at the developers of the third party libraries and JVMs that create the problems in the first place rather than at the community that has worked hard to: - prevent them causing an issue in the first place [1], [2] - cleans up the mess they leave behind where it can [3] - is trying to educate folks on what the problems are [4] > So, why can't Tomcat completely clean up our crappy java apps ;-) when a > reload is requested? It does what it can based on the examples we have seen so far. I am sure there is scope for improvement. Patches welcome - or at least a simple test case that demonstrates the issue. Mark [1] http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?view=log [2] http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java?view=log [3] http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?view=annotate (start at line 1984) [4] http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org