You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Dzmitry Kazimirchyk (JIRA)" <ji...@apache.org> on 2011/07/13 13:02:00 UTC
[jira] [Commented] (CAY-1587) Classloader memory leak in web apps
[ https://issues.apache.org/jira/browse/CAY-1587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064481#comment-13064481 ]
Dzmitry Kazimirchyk commented on CAY-1587:
------------------------------------------
I've reproduced this with cayenne tutorial webapp. Investigation on path from GC roots pointed to embedded derby database from tutorial. After replacing it with MySQL Tomcat stopped writing to logs any memory leak related messages. But it still reports on possible memory leak in manager. Investigation on this with profiler displays WebappClassLoader instances with 'started=false' held by 'Weak/Soft References'.
Anyway, after multiple reloading/redeploying tutorial webapp on Tomcat, GC cleans up these WebappClassLoader instances, so no crash happens. But it's still a question why don't they unload immediately.
> Classloader memory leak in web apps
> -----------------------------------
>
> Key: CAY-1587
> URL: https://issues.apache.org/jira/browse/CAY-1587
> Project: Cayenne
> Issue Type: Bug
> Components: Core Library
> Affects Versions: 3.1M2
> Environment: java version "1.6.0_24" on OSX and Linux, apache tomcat 7.0.16.
> Reporter: Anton Sakalouski
>
> Take sample web application from cayenne tutorial and deploy it to Tomcat. Go to Tomcat Manager App, find tutorial application and hit 'Stop' or 'Reload' buttons then 'Find leaks'. Tomcat manager will report the following message indicating memory leak
> 'The following web applications were stopped (reloaded, undeployed), but their
> classes from previous runs are still loaded in memory, thus causing a memory
> leak (use a profiler to confirm):'.
> And in Tomcat logs 'SEVERE: The web application [/test] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@2804f2ec]) and a value of type [org.apache.cayenne.di.spi.DefaultInjector] (value [org.apache.cayenne.di.spi.DefaultInjector@5ce8787a]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.'
> Connect to running Tomcat with YourKit and take memory dump, then go to Object Explorer and find 'WebAppClassLoader' instance having property 'started'=false, which means application was stopped but it's classloader wasn't cleaned up by GC. Click on 'Path from GC root' to investigate possible causes, also please refer to http://wiki.apache.org/tomcat/MemoryLeakProtection.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira