Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2012 12:35:27 +0200
From:      Mikolaj Golub <trociny@freebsd.org>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, Guy Helmer <ghelmer@palisadesystems.com>, svn-src-all@FreeBSD.org, Andrey Zonov <andrey@zonov.org>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r230869 - head/usr.sbin/daemon
Message-ID:  <86sjihsln4.fsf@kopusha.home.net>
In-Reply-To: <20120208090600.GA1308@garage.freebsd.pl> (Pawel Jakub Dawidek's message of "Wed, 8 Feb 2012 10:06:01 %2B0100")
References:  <27A0A960-F767-4D2C-BF3E-31F73FBF4E28@palisadesystems.com> <86zkcy5ur9.fsf@kopusha.home.net> <20120205093938.GC30033@garage.freebsd.pl> <86lioh7yz5.fsf@kopusha.home.net> <20120205214647.GI30033@garage.freebsd.pl> <86sjiov29o.fsf@in138.ua3> <20120206082706.GA1324@garage.freebsd.pl> <86wr7zmy8f.fsf@kopusha.home.net> <20120206221742.GA1336@garage.freebsd.pl> <86liodu3me.fsf@in138.ua3> <20120208090600.GA1308@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wed, 8 Feb 2012 10:06:01 +0100 Pawel Jakub Dawidek wrote:

 PJD> On Wed, Feb 08, 2012 at 10:32:41AM +0200, Mikolaj Golub wrote:
 >> 
 >> On Mon, 6 Feb 2012 23:17:43 +0100 Pawel Jakub Dawidek wrote:
 >> 
 >>  PJD> On Mon, Feb 06, 2012 at 11:46:24PM +0200, Mikolaj Golub wrote:
 >> 
 >>  >> Thanks. The updated version is attached.
 >> 
 >>  PJD> Looks good to me.
 >> 
 >> Thanks. But I still think that adding some signal handling is a good idea. I
 >> agree that there may be no sense in trying to handle many different signals,
 >> but handling SIGTERM (software termination signal :-) nicely looks like a good
 >> thing.

 PJD> Ok:) In that case could you break you patch into one that only fixes the
 PJD> problem we discussed and the other that implements new functionality?

 >> This would solve problems like stale pid files after shutdown or orphaned
 >> programs (again with stale pid files and a possibility to start another
 >> instance) due to a user mistakenly terminated the supervising daemons.
 >> 
 >> Also it is possible then to add "automatic restart" option, as Andrey has
 >> proposed.
 >> 
 >> Here is the patch that does it. It also change proctitle to make identifying a
 >> a supervisor with its charge.

 PJD> I'd prefer to see more general solution to that problem, but I guess
 PJD> this can't hurt. I've only one suggestion based on my experience.
 PJD> Before you restart the program, wait for 1 second. This helps a lot when
 PJD> you have misbehaving program or some misconfiguration that make the
 PJD> process to exit immediately.

 >> A technical question concerning the patch :-). Does sombody know if
 >> sigwaitinfo() may be interrupted in my case and I should check for EINTR, as I
 >> do in the patch?

 PJD> Calling sigwaitinfo() with second argument equal to NULL is equivalent
 PJD> to calling sigwait(). The only difference is that sigwait() cannot be
 PJD> interrupted by signal, thus never sets errno to EINTR. Why not to use
 PJD> just that?

Thank you. Here are the patches I would like to commit if there are no
objections or other suggestions:

http://people.freebsd.org/~trociny/daemon/daemon.spawn.1.patch
http://people.freebsd.org/~trociny/daemon/daemon.SIGTERM.1.patch
http://people.freebsd.org/~trociny/daemon/daemon.restart.1.patch

-- 
Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86sjihsln4.fsf>