[jboss-jira] [JBoss JIRA] Commented: (JBAS-5222) ClassLoader leak in BasicThreadPool
Brian Stansberry (JIRA)
jira-events at lists.jboss.org
Thu Feb 7 20:30:03 EST 2008
[ http://jira.jboss.com/jira/browse/JBAS-5222?page=comments#action_12398847 ]
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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list