How to delete unix socket entries

Terry Lambert tlambert2 at mindspring.com
Wed Jun 25 03:22:59 PDT 2003


Varshavchick Alexander wrote:
> Terry, you're right that all this happened because of the server
> application core dumped while in the process of sending/receiving data,
> and that application is fixed so there are no new zombi sockets, but what
> can I do now with the ones which already exist? How can I delete them now?

If it's fixed: reboot.

If it's not fixed, add this to your /etc/rc.local:

	sysctl net.inet.tcp.always_keepalive=0

...and reboot.

Nothing short of rebooting is going to undo the deadlock, unless
you have the kernel debugger compiled into your kernel, and are
willing to grovel around in data structures to find the root cause
of your problem.

There is no such thing as a "zombie socket", there are only sockets
which are in TIME_WAIT, FIN_WAIT, FIN_WAIT_2, etc., states.  These
tend to persist for 2MSL (about 5 minutes) after the process has
exited.

That you are having this problem is indicative of the other end of
the socket connection still being alive somewhere, and/or a real
bug that was triggered by the default being to set "keepalive" on
the sockets, even though they are UNIX domain sockets.  You could
probably fix this by overriding the "keepalive" setting on the
created sockets in the kernel function "socketpair".

Without a reproducible test case, I can't provide you a kernel patch
to fix the problem for you in the future.  My advice is to turn off
the keepalive; I expect it will help.

-- Terry


More information about the freebsd-hackers mailing list