-
Bug
-
Resolution: Done
-
Minor
-
JBossAS-5.0.0.Beta4
-
None
When LRUEnterpriseContextCachePolicy loads, it creates a static ref to Timer, which creates a Thread. A newly created thread inherits its TCCL from whatever thread created it, so whatever deployment classloader is the TCCL when LRUEnterpriseContextCachePolicy is loaded, that classloader get leaked to the timer thread.
This is the cause of the failure of ClassloaderLeakUnitTestCase.testSimpleEjb().
JBoss Profiler heap analysis shows the path to the static Timer ref:
!--BaseClassLoader@d279e2
{vfsfile:/C:/dev/jboss/jboss-head/testsuite/output/lib/classloader-leak-ejb.jar}!-!-FieldReference private java.lang.ClassLoader java.lang.Thread.contextClassLoader=Thread[Timer-2,5,RMI Runtime]
!-!!-FieldReference private java.util.TimerThread java.util.Timer.thread=java.util.Timer@5a9fcd
!-!!!-StaticFieldReference protected static java.util.Timer org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy.tasksTimer
A fix is to set the TCCL to LRUEnterpriseContextCachePolicy.class.getClassLoader() before creating the timer, and then restoring it.
- blocks
-
JBAS-5252 Fix classloader leak test failures
- Closed