From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 24 10:23:04 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDEE137B401 for ; Tue, 24 Jun 2003 10:23:04 -0700 (PDT) Received: from apache.metrocom.ru (apache.metrocom.ru [195.5.128.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id B5A6543F85 for ; Tue, 24 Jun 2003 10:23:03 -0700 (PDT) (envelope-from alex@metrocom.ru) Received: from apache (apache [195.5.128.150]) by apache.metrocom.ru (8.12.9/8.12.9) with ESMTP id h5OHN1mm013245; Tue, 24 Jun 2003 21:23:01 +0400 (MSD) Date: Tue, 24 Jun 2003 21:23:01 +0400 (MSD) From: Varshavchick Alexander To: Paul Robinson In-Reply-To: <20030624171426.GU34365@iconoplex.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-2.0 required=4.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES,USER_AGENT_PINE version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to delete unix socket entries X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jun 2003 17:23:05 -0000 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)