james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Wiederkehr (JIRA)" <server-...@james.apache.org>
Subject [jira] Commented: (JAMES-767) exception when shutting down server
Date Thu, 11 Sep 2008 17:31:45 GMT

    [ https://issues.apache.org/jira/browse/JAMES-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630266#action_12630266
] 

Markus Wiederkehr commented on JAMES-767:
-----------------------------------------

Okay, here is what I have figured out so far. I have included the source code of excalibur-thread-impl-2.1.jar
in my Eclipse project. This jar-file contains the class DefaultThreadPool in question.

This is the critical code:

73:  public void dispose()
74:  {
75:    m_pool.dispose();
76:    this.destroy();
77:  }

DefaultThreadPool extends ThreadGroup so this.destroy() in line 76 actually call ThreadGroup.destroy().

I put an invocation of ThreadGroup.list() between lines 75 and 76 and this is what I get as
output:

org.apache.avalon.excalibur.thread.impl.DefaultThreadPool[name=default,maxpri=10]
    Thread[default Worker #0,5,default]

So the ThreadGroup cannot be destroyed because there is still a worker thread lingering around.

The m_pool in line 75 is actually a SoftResourceLimitingPool from excalibur-pool-impl-2.1.jar.
This SoftResourceLimitingPool extends DefaultPool which has the following dispose method:

    public final void dispose()
    {
        try
        {
            m_mutex.acquire();
            try
            {
                while( m_ready.size() > 0 )
                {
                    this.removePoolable( (Poolable)m_ready.remove() );
                }
            }
            finally
            {
                m_mutex.release();
            }
        }
        catch( Exception e )
        {
            if( getLogger().isWarnEnabled() )
            {
                getLogger().warn( "Caught an exception disposing of pool", e );
            }
        }

        this.m_disposed = true;
    }

So it removes all elements from its ready pool. But if you take a look at the base class AbstractPool
you see that there is also a list of active elements m_active, which seems to be ignored in
the dispose method in DefaultPool.

So to summarize it looks like active threads in the pool are not terminated and as a result
the TreadGroup cannot be destroyed.

Maybe someone can take it from here?

> exception when shutting down server
> -----------------------------------
>
>                 Key: JAMES-767
>                 URL: https://issues.apache.org/jira/browse/JAMES-767
>             Project: James
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>         Environment: Mac OS X 10.4.8, intel Mac 2.16 GHz dual core, Java VM build 1.5.0_06-112
>            Reporter: Ray Kiddy
>            Priority: Minor
>
> I have set up a James server to test a mail client. I configure it with the IP address
of the machine. I do not use DNS, but instead us e-mail addresses like "adam@[10.0.1.6]".
When I shut down the server with ctl-C, I get:
> ^CJVM exiting abnormally. Shutting down Phoenix.
> org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleException: Component named
"thread-manager" failed to pass through the Destruction stage. (Reason: java.lang.IllegalThreadStateException).
>         at org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleHelper.fail(LifecycleHelper.java:354)
>         at org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleHelper.shutdown(LifecycleHelper.java:288)
>         at org.apache.avalon.phoenix.components.application.DefaultApplication.shutdown(DefaultApplication.java:566)
>         at org.apache.avalon.phoenix.components.application.DefaultApplication.doRunPhase(DefaultApplication.java:482)
>         at org.apache.avalon.phoenix.components.application.DefaultApplication.runPhase(DefaultApplication.java:409)
>         at org.apache.avalon.phoenix.components.application.DefaultApplication.stop(DefaultApplication.java:233)
>         at org.apache.avalon.framework.container.ContainerUtil.stop(ContainerUtil.java:292)
>         at org.apache.avalon.framework.container.ContainerUtil.shutdown(ContainerUtil.java:66)
>         at org.apache.avalon.phoenix.components.kernel.DefaultKernel.shutdown(DefaultKernel.java:346)
>         at org.apache.avalon.phoenix.components.kernel.DefaultKernel.removeApplication(DefaultKernel.java:455)
>         at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.undeploy(DefaultDeployer.java:244)
>         at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.dispose(DefaultDeployer.java:154)
>         at org.apache.avalon.framework.container.ContainerUtil.dispose(ContainerUtil.java:306)
>         at org.apache.avalon.framework.container.ContainerUtil.shutdown(ContainerUtil.java:67)
>         at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.shutdownComponents(DefaultEmbeddor.java:598)
>         at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.dispose(DefaultEmbeddor.java:342)
>         at org.apache.avalon.framework.container.ContainerUtil.dispose(ContainerUtil.java:306)
>         at org.apache.avalon.framework.container.ContainerUtil.shutdown(ContainerUtil.java:67)
>         at org.apache.avalon.phoenix.frontends.CLIMain.shutdown(CLIMain.java:326)
>         at org.apache.avalon.phoenix.frontends.CLIMain.forceShutdown(CLIMain.java:295)
>         at org.apache.avalon.phoenix.frontends.ShutdownHook.run(CLIMain.java:386)
> Caused by: java.lang.IllegalThreadStateException
>         at java.lang.ThreadGroup.destroy(ThreadGroup.java:750)
>         at org.apache.avalon.excalibur.thread.impl.DefaultThreadPool.dispose(DefaultThreadPool.java:76)
>         at org.apache.avalon.framework.container.ContainerUtil.dispose(ContainerUtil.java:306)
>         at org.apache.avalon.cornerstone.blocks.threads.AbstractThreadManager.dispose(AbstractThreadManager.java:69)
>         at org.apache.avalon.framework.container.ContainerUtil.dispose(ContainerUtil.java:306)
>         at org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleHelper.shutdown(LifecycleHelper.java:274)
>         ... 19 more

-- 
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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message