GNU bug report logs - #68087
Signal handlers not called after ‘primitive-fork’

Previous Next

Package: guile;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Thu, 28 Dec 2023 17:18:01 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-guile <at> gnu.org
Subject: Signal handlers not called after ‘primitive-fork’
Date: Thu, 28 Dec 2023 18:16:52 +0100
In 3.0.9 and current ‘main’, I get this:

--8<---------------cut here---------------start------------->8---
$ cat sigaction-fork.scm
(use-modules (ice-9 match))

;; This call spawns the signal delivery thread as a side effect.
(sigaction SIGALRM
  (lambda (signal)
    (pk 'got-signal! signal)))

(match (primitive-fork)
  (0
   (pk 'child (getpid))
   (sigaction SIGALRM
     (lambda (signal)
       ;; This handler is never called!
       (pk 'got-signal-child! signal)))
   (kill 0 SIGALRM)
   (pk 'alarm-sent))
  (_
   (primitive-exit 0)))
$ guile sigaction-fork.scm

;;; (child 30308)

;;; (alarm-sent)
--8<---------------cut here---------------end--------------->8---

Everything works fine if we remove the pre-fork ‘sigaction’ call.

Ludo’.




This bug report was last modified 1 year and 197 days ago.

Previous Next


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