Re: Problem with Linux sockets not closing

Eric.Schenk@dna.lth.se
Thu, 08 May 1997 23:23:33 +0200


Jim Torelli <jtorelli@coolworld.com> writes:
> The CloseSocket function sets SO_LINGER to abort the connection,
>calls shutdown(), then close(). I really don't think I'm doing anything
>wrong here.

There was a bug in earlier 2.0.x kernels that cause a shutdown() followed
by a close() to kill a socket immediately without finishing the
proper sequence of TCP shutdown events. I fixed this in 2.0.30, but
I had some brain slippage when writing the fix and missed a small case.
The result is that if you do a shutdown() then a close() in 2.0.30
you will get an extra FIN packet with a new sequence number, and
the observed problem with getting stuck in close(). I posted a patch
for this a couple of days ago which is present in the current pre-2.0.31
test patches. Please try the test patch and let me know if the problem
goes away.

As an aside a possible work around for the problem is to avoid doing
the shutdown() close() sequence, since the close() effectly does a
shutdown() anyway. Still, this should not be necessary and we should
fix the bug in the kernel.

BTW, I've had a vauge report that SO_LINGER does not work. Can you
tell me if it appears to be working correctly for you in the pre-2.0.31
tests?

-- 
Eric Schenk                               www: http://www.dna.lth.se/~erics
Dept. of Comp. Sci., Lund University          email: Eric.Schenk@dna.lth.se
Box 118, S-221 00 LUND, Sweden   fax: +46-46 13 10 21  ph: +46-46 222 96 38