Subject: port-i386/23567: tcp socket gets stuck in CLOSE_WAIT after program crash
To: None <>
From: None <>
List: netbsd-bugs
Date: 11/25/2003 15:12:14
>Number:         23567
>Category:       port-i386
>Synopsis:       tcp socket gets stuck in CLOSE_WAIT after program crash
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 25 15:13:00 UTC 2003
>Originator:     Christopher Leidigh
>Release:        1.6.1 porti386
NetBSD 1.6.1 NetBSD 1.6.1 (GENERIC) #0: Tue Apr  8 12:05:52 UTC 2003 i386

A simple web server program under development crashes at times (it's not done) and this has resulted in tcp sockets stuck in a CLOSE_WAIT state.  This has happened several times and so far the only recourse is a full reboot.  network restart does not appear to clear the socket table. The sockets in question are opened with SO_REUSEADDR socket option  

Searches reveal this was a problem several years ago but apprears to persist in 1.6.1.
Currently it is not clear if there are any exact circumstances to cause the problem.  A program with a server socket in SO_REUSEADDR set that has had at least one connection crashes and the tcp connection gets caught in the CLOSE_WAIT state.  Any program wishing to open a server socket on that port will fail.