You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Mark Swanson <ma...@ScheduleWorld.com> on 2007/05/06 07:40:54 UTC

Bug/Feature request: SO_REUSEADDR

Hello,

Please use SO_REUSEADDR when binding to TCP ports.
In production, when an ADS server is restarted it fails to start until 
all of the sockets that used to be connected exceed their FIN_WAIT1 
timeout.

I found a similar issue using Google:

http://mail-archives.apache.org/mod_mbox/directory-dev/200601.mbox/<828624750.1137724243574.JavaMail.jira%40ajax.apache.org>

I actually don't understand the resolution.
Shall I open a Jira issue for this?

Cheers.

-- 
http://www.ScheduleWorld.com/
Free Google Calendar synchronization with Outlook, Evolution,
cell phones, BlackBerry, PalmOS, Exchange, Mozilla, Thunderbird,
Pocket PC/Windows Mobile. Also sync tasks, notes and contacts!
WebDAV, vfreebusy, RSS, LDAP, iCalendar, iTIP, iMIP support.

Re: Bug/Feature request: SO_REUSEADDR

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Just a FYI:

https://issues.apache.org/jira/browse/DIRSERVER-926

Cheers.


-- 
http://www.ScheduleWorld.com/
Free Google Calendar synchronization with Outlook, Evolution,
cell phones, BlackBerry, PalmOS, Exchange, Mozilla, Thunderbird,
Pocket PC/Windows Mobile. Also sync tasks, notes and contacts!
WebDAV, vfreebusy, RSS, LDAP, iCalendar, iTIP, iMIP support.

Re: Bug/Feature request: SO_REUSEADDR

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Emmanuel Lecharny wrote:
> Mark Swanson a écrit :
> 
>> Hello,
> 
> Hi Mark !
> 
>>
>> Please use SO_REUSEADDR when binding to TCP ports.
>> In production, when an ADS server is restarted it fails to start until 
>> all of the sockets that used to be connected exceed their FIN_WAIT1 
>> timeout.
> 
> This is already done :
> 
> ...
>        try
>        {
>            // Disable the disconnection of the clients on unbind
>            SocketAcceptorConfig acceptorCfg = new SocketAcceptorConfig();
>            acceptorCfg.setDisconnectOnUnbind( false );
>            acceptorCfg.setReuseAddress( true );
> ...
> 
> either in 1.0 or in 1.5.
> 
> There must be something different.

Well, just to be sure the line numbers match up so we're talking about 
the same code here is the Exception:

[00:38:48] ERROR [org.apache.directory.daemon.Bootstrapper] - Failed on 
org.apache.directory.server.Service.init(InstallationLayout, String[])
org.apache.directory.shared.ldap.exception.LdapConfigurationException: 
Failed to bind an LDAPservice (389) to the service registry. [Root 
exception is java.net.BindException: Address already in use]
     at 
org.apache.directory.server.jndi.ServerContextFactory.startLDAP0(ServerContextFactory.java:487)
     at 
org.apache.directory.server.jndi.ServerContextFactory.startLDAP(ServerContextFactory.java:401)
     at 
org.apache.directory.server.jndi.ServerContextFactory.afterStartup(ServerContextFactory.java:211)
     at 
org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:239)
     at 
org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialContext(AbstractContextFactory.java:118)
     at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
     at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
     at javax.naming.InitialContext.init(InitialContext.java:223)
     at javax.naming.InitialContext.<init>(InitialContext.java:197)
     at 
javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:82)
     at org.apache.directory.server.Service.init(Service.java:96)
     at 
org.apache.directory.daemon.Bootstrapper.callInit(Bootstrapper.java:151)
     at 
org.apache.directory.daemon.JsvcBootstrapper.init(JsvcBootstrapper.java:56)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at 
org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:160)
Caused by: java.net.BindException: Address already in use
     at sun.nio.ch.Net.bind(Native Method)
     at 
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
     at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
     at 
org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:429)
     at 
org.apache.mina.transport.socket.nio.SocketAcceptor.access$900(SocketAcceptor.java:52)
     at 
org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:258) 
    at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:43)
     at java.lang.Thread.run(Thread.java:619)

Once all of the existing connections leave FIN_WAIT1 this Exception does 
not happen and the server starts normally.

>>
>> I actually don't understand the resolution.
>> Shall I open a Jira issue for this?
> 
> Yes, I think you should. If the setReuseAddress(true) is not enough, 
> then we need to find something else.
> 
> Can you also add some vital information about the version, the JVM and 
> the system your are using ?

ADS 1.0.1
Linux CentOS 4.4, latest patches, java -version:

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode)

I will post this all to Jira tomorrow.

Cheers.


-- 
http://www.ScheduleWorld.com/
Free Google Calendar synchronization with Outlook, Evolution,
cell phones, BlackBerry, PalmOS, Exchange, Mozilla, Thunderbird,
Pocket PC/Windows Mobile. Also sync tasks, notes and contacts!
WebDAV, vfreebusy, RSS, LDAP, iCalendar, iTIP, iMIP support.

Re: Bug/Feature request: SO_REUSEADDR

Posted by Emmanuel Lecharny <el...@apache.org>.
Mark Swanson a écrit :

> Hello,

Hi Mark !

>
> Please use SO_REUSEADDR when binding to TCP ports.
> In production, when an ADS server is restarted it fails to start until 
> all of the sockets that used to be connected exceed their FIN_WAIT1 
> timeout.

This is already done :

...
        try
        {
            // Disable the disconnection of the clients on unbind
            SocketAcceptorConfig acceptorCfg = new SocketAcceptorConfig();
            acceptorCfg.setDisconnectOnUnbind( false );
            acceptorCfg.setReuseAddress( true );
...

either in 1.0 or in 1.5.

There must be something different.

>
> I actually don't understand the resolution.
> Shall I open a Jira issue for this?

Yes, I think you should. If the setReuseAddress(true) is not enough, 
then we need to find something else.

Can you also add some vital information about the version, the JVM and 
the system your are using ?

Thanks !
Emmanuel