Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 2003 21:23:01 +0400 (MSD)
From:      Varshavchick Alexander <alex@metrocom.ru>
To:        Paul Robinson <paul@iconoplex.co.uk>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to delete unix socket entries
Message-ID:  <Pine.GSO.4.33.0306242117540.9816-100000@apache.metrocom.ru>
In-Reply-To: <20030624171426.GU34365@iconoplex.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 24 Jun 2003, Paul Robinson wrote:

> On Tue, Jun 24, 2003 at 08:59:49PM +0400, Varshavchick Alexander wrote:
>
> > I had a wrong-behaved server application which opened a unix socket to
> > respond to incoming connections, so that after the socket was opened, the
> > application core dumped each time it was launched. As a result, 'netstat
> > -f unix' now shows a lot of not-needed active entries. Is there any way to
> > delete them, or will they eventually die by themselves?
>
> A "better" way to do this is to use sockstat:
>
> paul@hannibal:~> sockstat -u
> USER     COMMAND    PID   FD PROTO  ADDRESS
> root     screen   30084    4 stream /tmp/screens/S-paul/30084.ttyp0.hannibal
> root     pure-ftp 22112    3 dgram  syslogd[67]:3
> root     named    56824    3 dgram  syslogd[67]:3
> root     ntpd     11575    3 dgram  syslogd[67]:3
> mysql    mysqld   53779    6 stream /tmp/mysql.sock
> root     syslogd     67    3 dgram  /var/run/log

Surely, but sockstat shows only the correct number of entries, I mean that
it doesn't show anything that is due to be killed. Yet netstat shows a
whole lot (about 2000!) of entries like these:

b6eccf80 stream     17      0        0        0        0        0 /var/run/daemon.sock
b647a600 stream     17      0        0        0        0        0 /var/run/daemon.sock
b6a3c080 stream     17      0        0        0        0        0 /var/run/daemon.sock
b6a3c100 stream     17      0        0        0        0        0 /var/run/daemon.sock

Only two of them seems to be usefull:
b61103c0 stream      0      0        0 b631a440        0        0 /var/run/daemon.sock
b5ec0440 stream      0      0 b5bfb2c0        0        0        0 /var/run/daemon.sock

How can I get rid of these extra ones?

>
> paul@hannibal:~>
>
> you then *know* which are the safe sockets to destroy. If it's a stream
> socket, you've got a file that you can rm - they're not going anywhere of
> their own accord.*
>
> The short answer then is "rm them, but make sure you rm the right ones".
>
> --
> Paul Robinson
>
> * If you reboot the machine, depending on how things are setup on your
> machine, /tmp and /var/tmp may or may not get rm'ed anyway, so the system
> has "cleared" the sockets on your behalf.
>


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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.33.0306242117540.9816-100000>