I keep hitting a case where an application we’re using crashes while a
connection is open. However, the socket seems to then get stuck in the
CLOSE_WAIT state (found using netstat). Unfortunately, FPORT (from
http://www.foundstone.com/) shows that it’s opened by the system process, so
I just can’t kill the process. Restarting and stopping the application does
not help (and it is then unable to get any connections on that port). I’ve
let it sit for quite a while, and it hasn’t gone away (I was hoping for some
TCP/IP timeout). The only cure seems to be to reset the box.
Is there any other way to get the socket out of that state? Perhaps some
utility (although I did a Net search)?
How would one protect against getting in that state in the code? (Aside
from fixing all known crash scenarios…)