[Spread-users] cannot re-connect
Jonathan Stanton
jonathan at cnds.jhu.edu
Fri Dec 1 08:08:57 EST 2006
This is a known limitation of TCP connections, if the server socket is
closed before the clients, the server socket enters a wait state for a
few minutes. During this time the server can not reuse the same port
number.
If you look in the sample spread.conf file, there is a documented option
called SocketPortReuse that can address this. It is set by default to
allow reusing the port number automatically if you bind to specific
interfaces (using the
node 192.185.23.5 {
D 192.185.23.5
C 127.0.0.1
}
node specification, instead of the simple general bind of just
listing one IP address.
However, you can set it to always reuse the port number by changing the
value to "ON". The reason we don't do this by default is that it is a
security risk because other processes on the same machine as the Spread
daemon can also bind to the same address/port as Spread then and capture
the Spread traffic or interfere with it (depending on OS/version)
If you set it to ON you will not have a problem with restarting the
spread daemon.
I understand your idea for a SpreadConnection.isConnected(), in many
cases I didn't think it was needed as whenever you try to use the
connection, if it was broken you will get an immediate error and can
recover from it by reconnecting. Is there some other scenario where it
would be useful?
Cheers,
Jonathan
On Fri, Dec 01, 2006 at 11:41:26AM +0100, Torsten Curdt wrote:
> Here is the scenario:
>
> Spread is running and from a java application I join the spread ring
> on the same machine. Now when I stop the spread ring I see a
> SpreadException raised in the java code.
>
> SpreadException: spread.SpreadException: Connection closed while reading
> header
>
> Now trying to start spread again it refuses to start because it claims
> to be already running
>
> Sess_init: INET unable to bind to port 4803, already running
>
> But all there is is a tcp connection in CLOSE_WAIT
>
> $ netstat -an|grep 4803
> tcp4 0 0 127.0.0.1.61648 127.0.0.1.4803
> CLOSE_WAIT
>
> Any clues what migh be the problem? I want to be able to re-start
> spread and have the java code re-establish the connection. Some
> SpreadConnection.isConnected() would nice for that too btw.
> Using spread 4rc2.
>
> cheers
> --
> Torsten
>
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
--
-------------------------------------------------------
Jonathan R. Stanton jonathan at cs.jhu.edu
Dept. of Computer Science
Johns Hopkins University
-------------------------------------------------------
More information about the Spread-users
mailing list