6 Dec 2005 00:30
[jira] Created: (HIVEMIND-161) ThreadLocal object is never removed in ThreadEventNotifierImpl and holds the classloader
Kyrill Alyoshin (JIRA <hivemind-dev <at> jakarta.apache.org>
2005-12-05 23:30:08 GMT
2005-12-05 23:30:08 GMT
ThreadLocal object is never removed in ThreadEventNotifierImpl and holds the classloader
----------------------------------------------------------------------------------------
Key: HIVEMIND-161
URL: http://issues.apache.org/jira/browse/HIVEMIND-161
Project: HiveMind
Type: Bug
Components: framework
Versions: 1.1
Environment: Tomcat 5.5.12, J2SE 1.6 Mustang build 62, Win XP SP2
Reporter: Kyrill Alyoshin
Priority: Critical
The following prevents the web application classloader from being garbage collected on hot redeploys of
web applications.
Please note that the issue is present on J2SE 1.5 as well. I use 1.6 only because it has far better support for
JVMTI and as such the issue was easy to discover with YourKit profiler. Here it is:
1. org.apache.hivemind.service.impl.ThreadEventNotifierImpl puts EventListenerList ("list"
variable) on its private ThreadLocal "_storage" variable in addThreadCleanupListener method.
2. No where in that class does the actual list gets removed from ThreadLocal.
Thus, the WebappClassLoader cannot be garbage collected because one of the object that it loaded (i.e.
EventListenerList) is strongly referenced by live threads in the container, which leads to huge memory
leaks on hot-redeploys.
--
--
This message is automatically generated by JIRA.
(Continue reading)
Anyway, the point is that there is a private ThreadLocal variable (in particular "_storage" variable in
ThreadEventNotifierImpl) that is never "cleaned up" in that object. (There is simply nothing that does
"_storage.set(null);" in that class); therefore, this Thread (i.e. an object loaded by System
classloader) will always contain strong references to objects stored in "_storage" and, as a result,
WebappClassLoader will never be garbage collected along with everything it points to.
Howard said he's gonna look into it in a couple of days once he settles in his new home on the west coast.
> ThreadLocal object is never removed in ThreadEventNotifierImpl and holds the classloader
> ----------------------------------------------------------------------------------------
>
> Key: HIVEMIND-161
> URL:
RSS Feed