Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jun 2002 09:22:31 -0400 (EDT)
From:      "Geoffrey C. Speicher" <geoff@sea-incorporated.com>
To:        freebsd-stable@FreeBSD.ORG
Cc:        Oliver Fromme <olli@secnetix.de>, "Matthew D. Fuller" <fullermd@over-yonder.net>, Paul Herman <pherman@frenchfries.net>, Matt Simerson <freebsd@blockads.com>
Subject:   Re: bug in pw, -STABLE [patch]
Message-ID:  <20020623090830.W29729-100000@sea-incorporated.com>
In-Reply-To: <200206231242.g5NCgU146607@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 23 Jun 2002, Oliver Fromme wrote:

> Sorry for jumping in here ...

S'arright, but I only got your message because I happen to have another
account subscribed to -stable.  :)  I brought the party back into the CC
list.

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

The beauty of encapsulating the pid file operations into a library is that
the implementation can be changed to create a socket instead of, or (more
likely) in addition to, a pid file.  In fact, this may be just the thing
we need to close that "pid gets reused" hole.

Since Matt already has the functions mostly implemented, I'll defer to
him.

Geoff


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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