On 21 Mar 2012, at 02:41, Dale Ogilvie <dale_ogil...@trimble.com> 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+ > > > > 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? You can turn the error notices and prevention functions off if you prefer? Otherwise, you're bothered because of the reason you describe above - your app causes a permgen OOM after N reloads. > When the application is unloaded by Tomcat, it > should go away completely, regardless of (for example) unstopped threads > in library foo. There is an aggressive thread killer option but it is unreliable, because it is hard to stop a Java thread from outside the thread. > My semi-rant is inspired by the following recent comment by Mladen Turk. > > "Entire IIS worker process recycling is meant for handling crappy .NET > applications with memory and resource leaks." > > So, why can't Tomcat completely clean up our crappy java apps ;-) when a > reload is requested? That is what Tomcat is trying to do. It unloads DB drivers that you haven't cleaned up, it prevents other JVM leaks, it recycles threads in the connector pool to prevent ThreadLocal leaks. If you can find a way to make it go more, patches are always welcome. Which reminds me... p > Thanks > > > > Dale > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org