[ 
https://issues.apache.org/jira/browse/EXLBR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631004#action_12631004
 ] 

Markus Wiederkehr commented on EXLBR-20:
----------------------------------------

I think a new bug was introduced by fixing this one and this issue should be 
re-opened.

A ThreadGroup cannot be destroyed if it still contains threads. ThreadGroup 
throws an IllegalThreadStateException if the group is not empty.

More specifically the DefaultThreadPool code from version 2.1 looks like this:
  public void dispose()
  {
    m_pool.dispose();
    this.destroy();
  }

m_pool is a BasicThreadPool which in turn has an underlying pool also called 
m_pool. Now assume that underlying pool is a SoftResourceLimitingPool from 
excalibur-pool-impl-2.1.jar.

The dispose() method of SoftResourceLimitingPool (declared in DefaultPool) 
removed all Poolable elements from its ready pool m_ready. But it does not do 
anything about the active elements in m_active.

As a consequence the thread group may not be empty and an 
IllegalThreadStateException is thrown.

See also JAMES-767 for an issue where this actually happens.

> org.apache.avalon.excalibur.thread.impl.DefaultThreadPool is not disposed 
> properly.
> -----------------------------------------------------------------------------------
>
>                 Key: EXLBR-20
>                 URL: https://issues.apache.org/jira/browse/EXLBR-20
>             Project: Excalibur Components
>          Issue Type: Bug
>          Components: Thread
>            Reporter: Pawel Stawicki
>            Assignee: Shash Chatterjee
>            Priority: Minor
>
> DefaultThreadPool extends ThreadGroup. When it is created and added to parent 
> ThreadGroup, ThreadGroup holds reference to it. When dispose is called, 
> parent ThreadGroup still has reference to it and garbage collector can not 
> collect it. It causes memory leak.
> This can be solved by calling destroy() in dispose method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to