From owner-freebsd-stable Sun Jun 23 5:42:43 2002 Delivered-To: freebsd-stable@freebsd.org Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130]) by hub.freebsd.org (Postfix) with ESMTP id 4900337B404 for ; Sun, 23 Jun 2002 05:42:32 -0700 (PDT) Received: (from olli@localhost) by lurza.secnetix.de (8.11.6/8.11.6) id g5NCgU146607; Sun, 23 Jun 2002 14:42:30 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Date: Sun, 23 Jun 2002 14:42:30 +0200 (CEST) Message-Id: <200206231242.g5NCgU146607@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG Reply-To: freebsd-stable@FreeBSD.ORG Subject: Re: bug in pw, -STABLE [patch] In-Reply-To: <20020622180011.V80651-100000@sea-incorporated.com> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.5-RELEASE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Sorry for jumping in here ... Geoffrey C. Speicher wrote: > On Sat, 22 Jun 2002, Matthew D. Fuller wrote: > > pidmond(8); reads /etc/pidmond.conf, which contains a list of PID files > > and actions. Every N-interval (in config file), scan the PID file and > > check if PID specified is still alive. If not, take given action (could > > range from 'restart' to 'remove PID file'). > > Hmm. This takes care of our problem, which was that pw(8) might > die and leave a stale pid file behind. It also takes care of the > problem of automatically restarting dead daemons, though as you > pointed out, init(8) could be used for this too, so I'm not sure > what pidmond(8) gives you for daemons. Actually, the concept of "PID files" is broken by design. You never know for sure if a running process with PID n is actually the one which created a PID file containing n in the first place. Unless the process used reliable locking, which most programs don't do. And even if you can identify the process for sure, then you don't know if it's still running or just hanging/sitting there doing nothing (for whatever reason). A much better approach would be to use UNIX domain sockets instead of PID files. That way, you could reliably check if a daemon is still alive. Using the kqueue mechanism, you could even easily write a tool that restarts a daemon instantly when it dies (well okay, init(8) can already do that, too). Furthermore, using a UNIX domain socket, you can control a daemon by sending commands to and receiving status information from it, which is much more flexible and versatile than sending signals. BIND already does some- thing like that (see ndc(8)). Alas, that would require changing almost every daemon we have ... Just my 0.02 Euro. Regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "All that we see or seem is just a dream within a dream" (E. A. Poe) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message