How to delete unix socket entries

Varshavchick Alexander alex at metrocom.ru
Wed Jun 25 04:34:06 PDT 2003


On Wed, 25 Jun 2003, Terry Lambert wrote:

> 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.
>

Thank you Terry for such a good explanation, you seem to be hitting the
core. To be more specific, this server socket application is a
spamassassin-milter filter for sendmail. This filter uses threads and it
didn't work with the native FreeBSD threads so I recompiled it with linux
threads. It workes steadily enough now, but from time to time something
seems to be turning wrong and the filter deadlocks leaving a lot of alive
socket connections.

As you see it's not to handy to reboot a server to turn off keepalive
setting, and besides, it seems to be unneeded to make it globally for the
server. Instead, I'd rather use your advice about setsockopt()
recompiling libmilter library without keepalives. It shouldn't have any
side effects on server load or anything else, what do you think?

----
Alexander Varshavchick, Metrocom Joint Stock Company
Phone: (812)118-3322, 118-3115(fax)








More information about the freebsd-hackers mailing list