From: Jelle Licht <jlicht@fsfe.org>
To: 27553@debbugs.gnu.org
Subject: [bug#27553] [PATCH shepherd] Register SIGCHLD handler after primitive fork
Date: Sun, 2 Jul 2017 03:11:01 +0200 [thread overview]
Message-ID: <CAPsKtf+QdRA-xJBddN2DU1Ad7hYntwmZVQ9RtTaLcFZ58aa5YA@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 897 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1104 bytes --]
[-- Attachment #2: 0001-Register-SIGCHLD-handler-after-primitive-fork.patch --]
[-- Type: text/x-patch, Size: 1294 bytes --]
From 2603a1f4201668c13f992dbde3dd46be4dc2c31d Mon Sep 17 00:00:00 2001
From: Jelle Licht <jlicht@fsfe.org>
Date: Sun, 2 Jul 2017 02:58:36 +0200
Subject: [PATCH] Register SIGCHLD handler after primitive-fork.
* modules/shepherd.scm (main): Move call to 'sigaction' so daemonized process
can handle SIGCHLD signal.
---
modules/shepherd.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index f7c169d..dfae7d6 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -142,9 +142,6 @@
;; Start the 'root' service.
(start root-service)
- ;; Install the SIGCHLD handler.
- (sigaction SIGCHLD respawn-service SA_NOCLDSTOP)
-
;; This _must_ succeed. (We could also put the `catch' around
;; `main', but it is often useful to get the backtrace, and
;; `caught-error' does not do this yet.)
@@ -164,6 +161,9 @@
(apply format #f (gettext (cadr args)) (caddr args))
(quit 1))))
+ ;; Install the SIGCHLD handler.
+ (sigaction SIGCHLD respawn-service SA_NOCLDSTOP)
+
(when (provided? 'threads)
;; XXX: This terrible hack allows us to make sure that signal handlers
;; get a chance to run in a timely fashion. Without it, after an EINTR,
--
2.13.2
next reply other threads:[~2017-07-02 1:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-02 1:11 Jelle Licht [this message]
2017-07-12 21:34 ` [bug#27553] [PATCH shepherd] Register SIGCHLD handler after primitive fork Ludovic Courtès
2017-07-14 12:19 ` Jelle Licht
2017-07-17 8:33 ` Ludovic Courtès
2017-07-27 14:32 ` Jelle Licht
2017-09-06 22:56 ` Jelle Licht
2017-09-07 14:49 ` bug#27553: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPsKtf+QdRA-xJBddN2DU1Ad7hYntwmZVQ9RtTaLcFZ58aa5YA@mail.gmail.com \
--to=jlicht@fsfe.org \
--cc=27553@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.