[ 
https://issues.apache.org/jira/browse/DIRSERVER-1915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny updated DIRSERVER-1915:
-----------------------------------------
    Description: 
After executing the code below, it's expected that server will shutdown 
gracefully, stopping all the threads. 

{code:java}
                LdapConnection  ldapConnection = … //admin connection
                GracefulShutdownRequest req = new GracefulShutdownRequestImpl();
                req.setDelay(0);
                req.setTimeOffline(0);
                
                ExtendedResponse res = ldapConnection.extended(req);
                ResultCodeEnum resultCode = res.getLdapResult().getResultCode();
                switch (resultCode)
                {
                                case SUCCESS :
                                                LOG.info("Server shutting 
down"); 
                                                break;
                                default :
                                                LOG.error ("Server shutdown 
failed : {} ", resultCode.toString());
                }
{code}

When the shutdown request is sent, the code continues past
{code:java}
 org.apache.mina.filter.executor.UnorderedThreadPoolExecutor:476
ran=true;  
{code}

The content of task object is this:

{noformat}
[(0x00000001: nio socket, server, null => /127.0.0.1:10389)] MESSAGE_RECEIVED: 
MessageType : EXTENDED_REQUEST Message ID : 2
    Extended request
        Request name : '1.3.6.1.4.1.18060.0.1.3'
org.apache.directory.api.ldap.extras.extended.GracefulShutdownRequestImpl@2a5eb8cf
{noformat}

After the shutdown code has executed and Result Code SUCCESS is returned, the 
following threads are still running. 

{noformat}
org.apache.directory.server.UberjarMain at localhost:61153      
        Daemon Thread [apacheds] (Running)      
        Daemon Thread [changePwdReplayCache.data] (Running)     
        Daemon Thread [kdcReplayCache.data] (Running)   
        Daemon Thread [ou=system.data] (Running)        
        Daemon Thread [groupCache.data] (Running)       
        Daemon Thread [Thread-1] (Running)      
        Daemon Thread [Thread-2] (Running)      
        Thread [NioSocketAcceptor-2] (Running)  
        Thread [pool-3-thread-1] (Running)      
        Thread [DestroyJavaVM] (Running)        
        Thread [pool-2-thread-1] (Running)      
        Thread [pool-7-thread-1] (Running)
{noformat}

If the shutdown code is called a second time, this exception occurs. 

{noformat}
org.apache.directory.ldap.client.api.exception.InvalidConnectionException: 
Cannot connect on the server: Connection refused: no further information
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.connect(LdapNetworkConnection.java:560)
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bindAsync(LdapNetworkConnection.java:1156)
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1076)
        at test.Shutdown.createConnection(Shutdown.java:93)
        at test.Shutdown.shutdown(Shutdown.java:32)
        at test.Shutdown.main(Shutdown.java:23)
Caused by: java.net.ConnectException: Connection refused: no further information
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at 
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:221)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:46)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.processConnections(AbstractPollingIoConnector.java:442)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.access$700(AbstractPollingIoConnector.java:64)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:510)
        at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
{noformat}



  was:

After executing the code below, it's expected that server will shutdown 
gracefully, stopping all the threads. 

                LdapConnection  ldapConnection = … //admin connection
                GracefulShutdownRequest req = new GracefulShutdownRequestImpl();
                req.setDelay(0);
                req.setTimeOffline(0);
                
                ExtendedResponse res = ldapConnection.extended(req);
                ResultCodeEnum resultCode = res.getLdapResult().getResultCode();
                switch (resultCode)
                {
                                case SUCCESS :
                                                LOG.info("Server shutting 
down"); 
                                                break;
                                default :
                                                LOG.error ("Server shutdown 
failed : {} ", resultCode.toString());
                }


When the shutdown request is sent, the code continues past
 org.apache.mina.filter.executor.UnorderedThreadPoolExecutor:476
ran=true;  

The content of task object is this:

[(0x00000001: nio socket, server, null => /127.0.0.1:10389)] MESSAGE_RECEIVED: 
MessageType : EXTENDED_REQUEST Message ID : 2
    Extended request
        Request name : '1.3.6.1.4.1.18060.0.1.3'
org.apache.directory.api.ldap.extras.extended.GracefulShutdownRequestImpl@2a5eb8cf

After the shutdown code has executed and Result Code SUCCESS is returned, the 
following threads are still running. 

org.apache.directory.server.UberjarMain at localhost:61153      
        Daemon Thread [apacheds] (Running)      
        Daemon Thread [changePwdReplayCache.data] (Running)     
        Daemon Thread [kdcReplayCache.data] (Running)   
        Daemon Thread [ou=system.data] (Running)        
        Daemon Thread [groupCache.data] (Running)       
        Daemon Thread [Thread-1] (Running)      
        Daemon Thread [Thread-2] (Running)      
        Thread [NioSocketAcceptor-2] (Running)  
        Thread [pool-3-thread-1] (Running)      
        Thread [DestroyJavaVM] (Running)        
        Thread [pool-2-thread-1] (Running)      
        Thread [pool-7-thread-1] (Running)

If the shutdown code is called a second time, this exception occurs. 

org.apache.directory.ldap.client.api.exception.InvalidConnectionException: 
Cannot connect on the server: Connection refused: no further information
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.connect(LdapNetworkConnection.java:560)
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bindAsync(LdapNetworkConnection.java:1156)
        at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1076)
        at test.Shutdown.createConnection(Shutdown.java:93)
        at test.Shutdown.shutdown(Shutdown.java:32)
        at test.Shutdown.main(Shutdown.java:23)
Caused by: java.net.ConnectException: Connection refused: no further information
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at 
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:221)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:46)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.processConnections(AbstractPollingIoConnector.java:442)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.access$700(AbstractPollingIoConnector.java:64)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:510)
        at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)





> Graceful Shutdown Extended Request does not appear to work. 
> ------------------------------------------------------------
>
>                 Key: DIRSERVER-1915
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1915
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.0.0-M16
>         Environment: Win / Java 32
>            Reporter: Carlo Accorsi
>            Priority: Major
>
> After executing the code below, it's expected that server will shutdown 
> gracefully, stopping all the threads. 
> {code:java}
>                 LdapConnection  ldapConnection = … //admin connection
>                 GracefulShutdownRequest req = new 
> GracefulShutdownRequestImpl();
>                 req.setDelay(0);
>                 req.setTimeOffline(0);
>                 
>                 ExtendedResponse res = ldapConnection.extended(req);
>                 ResultCodeEnum resultCode = 
> res.getLdapResult().getResultCode();
>                 switch (resultCode)
>                 {
>                                 case SUCCESS :
>                                                 LOG.info("Server shutting 
> down"); 
>                                                 break;
>                                 default :
>                                                 LOG.error ("Server shutdown 
> failed : {} ", resultCode.toString());
>                 }
> {code}
> When the shutdown request is sent, the code continues past
> {code:java}
>  org.apache.mina.filter.executor.UnorderedThreadPoolExecutor:476
> ran=true;  
> {code}
> The content of task object is this:
> {noformat}
> [(0x00000001: nio socket, server, null => /127.0.0.1:10389)] 
> MESSAGE_RECEIVED: MessageType : EXTENDED_REQUEST Message ID : 2
>     Extended request
>         Request name : '1.3.6.1.4.1.18060.0.1.3'
> org.apache.directory.api.ldap.extras.extended.GracefulShutdownRequestImpl@2a5eb8cf
> {noformat}
> After the shutdown code has executed and Result Code SUCCESS is returned, the 
> following threads are still running. 
> {noformat}
> org.apache.directory.server.UberjarMain at localhost:61153    
>       Daemon Thread [apacheds] (Running)      
>       Daemon Thread [changePwdReplayCache.data] (Running)     
>       Daemon Thread [kdcReplayCache.data] (Running)   
>       Daemon Thread [ou=system.data] (Running)        
>       Daemon Thread [groupCache.data] (Running)       
>       Daemon Thread [Thread-1] (Running)      
>       Daemon Thread [Thread-2] (Running)      
>       Thread [NioSocketAcceptor-2] (Running)  
>       Thread [pool-3-thread-1] (Running)      
>       Thread [DestroyJavaVM] (Running)        
>       Thread [pool-2-thread-1] (Running)      
>       Thread [pool-7-thread-1] (Running)
> {noformat}
> If the shutdown code is called a second time, this exception occurs. 
> {noformat}
> org.apache.directory.ldap.client.api.exception.InvalidConnectionException: 
> Cannot connect on the server: Connection refused: no further information
>       at 
> org.apache.directory.ldap.client.api.LdapNetworkConnection.connect(LdapNetworkConnection.java:560)
>       at 
> org.apache.directory.ldap.client.api.LdapNetworkConnection.bindAsync(LdapNetworkConnection.java:1156)
>       at 
> org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1076)
>       at test.Shutdown.createConnection(Shutdown.java:93)
>       at test.Shutdown.shutdown(Shutdown.java:32)
>       at test.Shutdown.main(Shutdown.java:23)
> Caused by: java.net.ConnectException: Connection refused: no further 
> information
>       at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
>       at 
> sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
>       at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:221)
>       at 
> org.apache.mina.transport.socket.nio.NioSocketConnector.finishConnect(NioSocketConnector.java:46)
>       at 
> org.apache.mina.core.polling.AbstractPollingIoConnector.processConnections(AbstractPollingIoConnector.java:442)
>       at 
> org.apache.mina.core.polling.AbstractPollingIoConnector.access$700(AbstractPollingIoConnector.java:64)
>       at 
> org.apache.mina.core.polling.AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:510)
>       at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:662)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to