GNU bug report logs - #27553
[PATCH shepherd] Register SIGCHLD handler after primitive fork

Previous Next

Package: guix-patches;

Reported by: Jelle Licht <jlicht <at> fsfe.org>

Date: Sun, 2 Jul 2017 01:12:01 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jelle Licht <jlicht <at> fsfe.org>
Cc: 27553 <at> debbugs.gnu.org
Subject: [bug#27553] [PATCH shepherd] Register SIGCHLD handler after primitive fork
Date: Wed, 12 Jul 2017 23:34:10 +0200
Hi Jelle,

Jelle Licht <jlicht <at> fsfe.org> skribis:

> I am not sure if this is also the proper ML for the GNU Shepherd, but
> looking in the archives lead me to believe it actually is. If not, I
> suggest the gnu.org page for shepherd be updated with the correct info.

It’s the right list.  :-)

> I recently starting playing around with user shepherd, and found out that
> when running a shepherd 0.3.2 daemonized as non-init process (via "(action
> 'shepherd 'daemonize)"), zombie processes are created whenever you start
> and subsequently stop any service.
>
> Thinking I did something wrong, I asked lfam on #guix to share his (very
> helpful) init.scm for user shepherd, yet I still noticed the same behaviour.
>
> I believe commit `efa2f45c5f7dc735407381b7b8a83d6c37f828db' inadvertently
> introduced an ordering issue, where the SIGCHLD handler is registered
> /before/ shepherd has the chance to daemonize. I believe the following
> trivial patch addresses this snafu.

The config file can start services, so the SIGCHLD handler must be
installed before we read the config file (otherwise we could be missing
some process termination notifications.)

Perhaps a solution would be to install the SIGCHLD handler lazily upon
the first ‘fork+exec-command’ call?  That would ensure both that (1)
users have a chance to daemonize before the handler is installed, and
(2) that the handler is installed before services are started.

Thoughts?

Ludo’.




This bug report was last modified 7 years and 319 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.