incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaakko <>
Subject Re: MultiThread Client problem with thrift
Date Tue, 22 Dec 2009 11:51:33 GMT

I don't know the particulars of java implementation, but if it works
the same way as Unix native socket API, then I would not recommend
setting linger to zero.

SO_LINGER option with zero value will cause TCP connection to be
aborted immediately as soon as the socket is closed. That is, (1)
remaining data in the send buffer will be discarded, (2) no proper
disconnect handshake and (3) receiving end will get TCP reset.

Sure this will avoid TIME_WAIT state, but TIME_WAIT is our friend and
is there to avoid packets from old connection being delivered to new
incarnation of the connection. Instead of avoiding the state, the
application should be changed so that TIME_WAIT will not be a problem.
How many open files you can see when the exception happens? Might be
that you're out of file descriptors.


On Tue, Dec 22, 2009 at 8:17 PM, Richard Grossman <> wrote:
> Hi
> To all is interesting I've found a solution seems not recommended but
> working.
> When opening a Socket set this:
>    tSocket.getSocket().setReuseAddress(true);
>    tSocket.getSocket().setSoLinger(true, 0);
> it's prevent to have a lot of connection TIME_WAIT state but not
> recommended.

View raw message