directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Karasulu <akaras...@apache.org>
Subject Re: TCP service not shutting down cleanly
Date Thu, 28 Dec 2006 13:55:09 GMT
Marc Boorshtein wrote:
>> Well, this is a rampant problem we have, and it don't want to vanish...
> 
> Odd, why didn't this happen in the original version I used?
> 
>> If you are on linux, you can modify you TCP keepalive parameter to a
>> smaller
>> value, so the socket will be freed faster.
>>
> 
> This didn't work.  How does the ApacheDS team handle this issue in
> it's automated tests?
> 
>> The problem might be that you violently stop the server, and some sockets
>> are still pending, waiting for a timeout. If you gently stop the server,
>> then I *think* mina closes all the opened socket nicely, and left the
>> socket
>> available immediatly. To be verified...
>>
> 
> Was the code I was using to stop my server incorrect?
> 

Hmmm I did not have a chance to look thoroughly at the code.  However
there is a paramter for MINA that we do use that may help you.  Look
here ...

            // Disable the disconnection of the clients on unbind
            SocketAcceptorConfig acceptorCfg = new SocketAcceptorConfig();
            acceptorCfg.setDisconnectOnUnbind( false );
            acceptorCfg.setReuseAddress( true );
            acceptorCfg.setFilterChainBuilder( chainBuilder );
            acceptorCfg.setThreadModel( threadModel );


((SocketSessionConfig)(acceptorCfg.getSessionConfig())).setTcpNoDelay(
true );

            tcpAcceptor.bind( new InetSocketAddress( port ),
protocolProvider.getHandler(), acceptorCfg );


Make sure you're using the following parameters to the acceptor config.
 Namely the reuse address true parameter.

HTH,
Alex

Mime
View raw message