--- Begin Message ---
Subject: |
[PATCH shepherd] Register SIGCHLD handler after primitive fork |
Date: |
Sun, 2 Jul 2017 03:11:01 +0200 |
Hi all,
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.
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.
Regards,
Jelle
0001-Register-SIGCHLD-handler-after-primitive-fork.patch
Description: Text Data
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#27553] [PATCH shepherd] Register SIGCHLD handler after primitive fork |
Date: |
Thu, 07 Sep 2017 16:49:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Heya!
Jelle Licht <address@hidden> skribis:
> I just tested what Ludo' proposed, and it seems to work like a charm.
> Seeing as we might be seeing more non-init shepherd instances w.r.t.
> user services and the possible service extension to `guix environment',
> I think it would be a good call to fix this bug :-).
Indeed, thanks for the reminder.
> From db942182224dfc0accad94897dd2122b128eef07 Mon Sep 17 00:00:00 2001
> From: Jelle Licht <address@hidden>
> Date: Thu, 7 Sep 2017 00:52:49 +0200
> Subject: [PATCH] Lazily register SIGCHLD hander on first call to
> 'fork+exec-command'.
>
> * modules/shepherd.scm (main): Move unconditional top-level call to
> 'sigaction' to...
> * modules/shepherd/service.scm (fork+exec-command): here. Use new variable.
> (%sigchld-handler-installed?): New variable.
LGTM, applied!
Ludo’.
--- End Message ---