Re: SO_LINGER not working?

David S. Miller (
Mon, 23 Jun 1997 06:46:40 -0400

From: Holger Kiehl <>

Is this a bug or am I doing something wrong?

You are doing something wrong, you think that zapping time waiters is
a good idea...

The server is used to handle lots of connections that disconnect
very quickly. On Linux I will then have lots of connections in the
TIME_WAIT state. Is there another solution, other then the
SO_LINGER option, to avoid connections hanging around in the
TIME_WAIT state?

Setting linger to zero to zap time waiters is not only anti-social,
the various IP working groups state that it is strongly discouraged
upon, both in the RFC's and elsewhere. The TIME_WAIT state was
created for a specific purpose, by zapping the socket before the
TIME_WAIT timeout occurs you are defeating the purpose of it.

Even FreeBSD's stack has this old linger==0 behavior totally removed.

I refuse to reverse the behavior we currently have, and I think Eric
Schenk will agree totally with me on this.

With the current TCP stack in 2.0.30+ and all current 2.1.x, lots of
time waiters can only eat memory, they most likely will not create
performance problems. I have tested the current algorithms to only
fall apart at around 10,000 time waiter's with a 100Mhz cpu, if you
have more time waiters than this you have other problems...

David "Sparc" Miller