]
Brian Stansberry commented on JBAS-5222:
----------------------------------------
This will require a new release of common-core.
ClassLoader leak in BasicThreadPool
-----------------------------------
Key: JBAS-5222
URL:
http://jira.jboss.com/jira/browse/JBAS-5222
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: ClassLoading
Affects Versions: JBossAS-5.0.0.Beta3
Reporter: Brian Stansberry
Assigned To: Brian Stansberry
Fix For: JBossAS-5.0.0.CR1
BasicThreadPool leaks the TCCL of whatever thread is executing when it needs to add
threads to the pool. When it's ThreadPoolExecutor needs another thread to handle a
task, it calls BasicThreadPool.ThreadPoolThreadFactory.newThread(Runnable) which does
this:
String threadName = BasicThreadPool.this.toString() + "-" +
lastThreadNumber.incrementAndGet();
Thread thread = new Thread(threadGroup, runnable, threadName);
thread.setDaemon(true);
return thread;
The new thread will inherit the TCCL from the old one. Nothing ever clears the TCCL from
the pooled thread.
A couple possible solutions come to mind:
1) Set the new thread's TCCL to null in ThreadPoolThreadFactory.newThread()
2) Subclass ThreadPoolExecutor, override the afterExecute() method, and set the TCCL to
null there. The afterExecute() method is invoked at the completion of each task.
The latter seems preferable, or perhaps both. A question is whether they should set the
TCCL to BasicThreadPool.class.getClassLoader() instead of null. That doesn't sound
right though.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: