From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 28 12:17:09 2023 Received: (at submit) by debbugs.gnu.org; 28 Dec 2023 17:17:09 +0000 Received: from localhost ([127.0.0.1]:40251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rIu0L-0006gB-47 for submit@debbugs.gnu.org; Thu, 28 Dec 2023 12:17:09 -0500 Received: from lists.gnu.org ([2001:470:142::17]:57402) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rIu0H-0006fa-6D for submit@debbugs.gnu.org; Thu, 28 Dec 2023 12:17:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rIu0B-0004Ha-S9 for bug-guile@gnu.org; Thu, 28 Dec 2023 12:17:00 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rIu0A-0007vD-Pp for bug-guile@gnu.org; Thu, 28 Dec 2023 12:16:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=sE+kE+GN5vGGLLpLB0RcEhey/EoPk9E0g1qXzAGNr80=; b=A+xytlpE4gWrVE agpuJdgqEr5WEm16jOu03cgOXcwzqK49jYnrEZ5oH6NbrauDRqmbcmSPiFn+1zEEehUCrtvGe2ko8 PnoSsf8AK1K1sG8H52bPu8SJUhY9DrWlP3I7sVw1mm7ASf+40pEYXA488x+h/pN+KzPV2fG3mCftk KA/wUPSa5lpVs/hqUO4+minyV+Yt9YgD3oHQXQ/3VXYB2NpAitZFbNiH+XiIs2OQdDrwYdE1mAtqB yJqCVZkyHAVUpVBBLKLisUo2D7UdznO3KIOXg74UmyfJ+I54ho5gIaeWiAzAncyJuJ4aOpnvQs2Yf mHabi3AXiPgf6vyBtIvw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: bug-guile@gnu.org Subject: Signal handlers not called after =?utf-8?Q?=E2=80=98primitive-for?= =?utf-8?Q?k=E2=80=99?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Octidi 8 =?utf-8?Q?Niv=C3=B4se?= an 232 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Fumier X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 28 Dec 2023 18:16:52 +0100 Message-ID: <87tto2gscb.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) In 3.0.9 and current =E2=80=98main=E2=80=99, 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 =E2=80=98sigaction=E2=80=99= call. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 05 13:14:29 2024 Received: (at 68087) by debbugs.gnu.org; 5 Jan 2024 18:14:29 +0000 Received: from localhost ([127.0.0.1]:57825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLoiC-0005D5-3H for submit@debbugs.gnu.org; Fri, 05 Jan 2024 13:14:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLoi8-0005Cq-L4 for 68087@debbugs.gnu.org; Fri, 05 Jan 2024 13:14:26 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLohy-0007wg-6m; Fri, 05 Jan 2024 13:14:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=czzECASdCcVe7l5qDh+i+Ck4sYqwQa9Nz2IXeGaFAIo=; b=fZ7v57MYJjcR+h vdfIzXf5pnzoMjDvYKBMB/y3vaIAFQIYmXtKnNls2O7LeugFMguoccUrQcDO7gdZw5/Yeq1MI6SVm HqgJGhr4zLxhS5CKuyPKW/MramWI7VqHYOxnG7ljdulRd0MQKdY3q+Kd9O5mt+6fcViBUHRm3qdA+ i5iFzD2UcENdU7U4p7UPAZ7Xg6OQyj0UjIVgkCbMeYBt/F8Y2SezcQsT4Mzf4aaToy/VAyhZ1hNVV IZIhEB4o5+GNNdbgilmPkxF9DgrEVhn4V6YTsWR0NhydaeHlP8xfytOXs61t3pyRQmPovb3s3OJZD Zpfif3OTtOEJ2bkFdYUg==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 68087@debbugs.gnu.org Subject: [PATCH] Stop signal thread before forking, restart it afterwards. Date: Fri, 5 Jan 2024 19:14:04 +0100 Message-ID: <20240105181404.2181-1-ludo@gnu.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68087 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Fixes . * libguile/scmsigs.h (scm_i_signals_pre_fork, scm_i_signals_post_fork): New declarations. (scm_i_signal_delivery_thread): Change type to SCM.. * libguile/threads.c (scm_all_threads): Adjust accordingly and exclude threads that have ‘t->exited’. Access ‘thread_count’ after grabbing ‘thread_admin_mutex’. * libguile/posix.c (scm_fork): Add calls to ‘scm_i_signals_pre_fork’ and ‘scm_i_signals_post_fork’. * libguile/scmsigs.c (signal_delivery_thread): Close signal_pipe[0] upon exit and set it to -1. (once): New file-global variable, moved from… (scm_i_ensure_signal_delivery_thread): … here. (stop_signal_delivery_thread, scm_i_signals_pre_fork) (scm_i_signals_post_fork): New functions. * test-suite/standalone/test-sigaction-fork: New file. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it. --- libguile/posix.c | 6 ++ libguile/scmsigs.c | 62 ++++++++++++++++- libguile/scmsigs.h | 6 +- libguile/threads.c | 17 +++-- test-suite/standalone/Makefile.am | 6 +- test-suite/standalone/test-sigaction-fork | 85 +++++++++++++++++++++++ 6 files changed, 168 insertions(+), 14 deletions(-) create mode 100755 test-suite/standalone/test-sigaction-fork Hello! Here’s a fix I’ve come up with: just like for the finalizer thread, stop the signal thread before forking, and in this case start it again after fork if needed. It fixes the immediate problem, but the test also shows the perils with all this asynchronous signal handling. I’d like to investigate ways to make signal handling somewhat more predictable (pselect(2), as suggested on Mastodon by Sergey Bugaev, is probably part of the solution). Thoughts? Ludo’. diff --git a/libguile/posix.c b/libguile/posix.c index 6ce78ee18..f7d68200b 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1295,7 +1295,10 @@ SCM_DEFINE (scm_fork, "primitive-fork", 0, 0, 0, #define FUNC_NAME s_scm_fork { int pid; + scm_i_finalizer_pre_fork (); + scm_i_signals_pre_fork (); + if (scm_ilength (scm_all_threads ()) != 1) /* Other threads may be holding on to resources that Guile needs -- it is not safe to permit one thread to fork while others are @@ -1317,6 +1320,9 @@ SCM_DEFINE (scm_fork, "primitive-fork", 0, 0, 0, if (pid == -1) SCM_SYSERROR; + + scm_i_signals_post_fork (); + return scm_from_int (pid); } #undef FUNC_NAME diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c index f7c3d7fbd..3d4e72a2b 100644 --- a/libguile/scmsigs.c +++ b/libguile/scmsigs.c @@ -86,7 +86,7 @@ static SCM signal_handler_asyncs; static SCM signal_handler_threads; /* The signal delivery thread. */ -scm_thread *scm_i_signal_delivery_thread = NULL; +SCM scm_i_signal_delivery_thread = SCM_BOOL_F; /* The mutex held when launching the signal delivery thread. */ static scm_i_pthread_mutex_t signal_delivery_thread_mutex = @@ -196,6 +196,9 @@ signal_delivery_thread (void *data) perror ("error in signal delivery thread"); } + close (signal_pipe[0]); + signal_pipe[0] = -1; + return SCM_UNSPECIFIED; /* not reached unless all other threads exited */ } @@ -211,18 +214,35 @@ start_signal_delivery_thread (void) signal_thread = scm_spawn_thread (signal_delivery_thread, NULL, scm_handle_by_message, "signal delivery thread"); - scm_i_signal_delivery_thread = SCM_I_THREAD_DATA (signal_thread); + scm_i_signal_delivery_thread = signal_thread; scm_i_pthread_mutex_unlock (&signal_delivery_thread_mutex); } +static scm_i_pthread_once_t once = SCM_I_PTHREAD_ONCE_INIT; + void scm_i_ensure_signal_delivery_thread () { - static scm_i_pthread_once_t once = SCM_I_PTHREAD_ONCE_INIT; scm_i_pthread_once (&once, start_signal_delivery_thread); } +static void +stop_signal_delivery_thread () +{ + scm_i_pthread_mutex_lock (&signal_delivery_thread_mutex); + + if (scm_is_true (scm_i_signal_delivery_thread)) + { + close (signal_pipe[1]); + signal_pipe[1] = -1; + scm_join_thread (scm_i_signal_delivery_thread); + scm_i_signal_delivery_thread = SCM_BOOL_F; + } + + scm_i_pthread_mutex_unlock (&signal_delivery_thread_mutex); +} + #else /* !SCM_USE_PTHREAD_THREADS */ static void @@ -248,8 +268,44 @@ scm_i_ensure_signal_delivery_thread () return; } +static void +stop_signal_delivery_thread () +{ + return; +} + #endif /* !SCM_USE_PTHREAD_THREADS */ +/* Perform pre-fork cleanup by stopping the signal delivery thread. */ +void +scm_i_signals_pre_fork () +{ + stop_signal_delivery_thread (); +} + +/* Perform post-fork setup by restarting the signal delivery thread if + it was active before fork. This happens in both the parent and the + child process. */ +void +scm_i_signals_post_fork () +{ + int active = 0; + + for (int sig = 0; sig < NSIG; sig++) + { + if (scm_is_true (SCM_SIMPLE_VECTOR_REF (signal_handler_threads, sig)) + || scm_is_true (SCM_SIMPLE_VECTOR_REF (signal_handler_asyncs, sig))) + { + active = 1; + break; + } + } + + once = SCM_I_PTHREAD_ONCE_INIT; + if (active) + scm_i_ensure_signal_delivery_thread (); +} + static void install_handler (int signum, SCM thread, SCM handler) { diff --git a/libguile/scmsigs.h b/libguile/scmsigs.h index 1837833c3..876690fa5 100644 --- a/libguile/scmsigs.h +++ b/libguile/scmsigs.h @@ -1,7 +1,7 @@ #ifndef SCM_SCMSIGS_H #define SCM_SCMSIGS_H -/* Copyright 1995-1998,2000,2002,2006-2008,2018 +/* Copyright 1995-1998,2000,2002,2006-2008,2018,2023 Free Software Foundation, Inc. This file is part of Guile. @@ -43,7 +43,9 @@ SCM_INTERNAL void scm_init_scmsigs (void); SCM_INTERNAL void scm_i_close_signal_pipe (void); SCM_INTERNAL void scm_i_ensure_signal_delivery_thread (void); +SCM_INTERNAL void scm_i_signals_pre_fork (void); +SCM_INTERNAL void scm_i_signals_post_fork (void); -SCM_INTERNAL scm_thread *scm_i_signal_delivery_thread; +SCM_INTERNAL SCM scm_i_signal_delivery_thread; #endif /* SCM_SCMSIGS_H */ diff --git a/libguile/threads.c b/libguile/threads.c index ca6403cb2..e2bdd7007 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -1681,18 +1681,19 @@ SCM_DEFINE (scm_all_threads, "all-threads", 0, 0, 0, "Return a list of all threads.") #define FUNC_NAME s_scm_all_threads { - /* We can not allocate while holding the thread_admin_mutex because - of the way GC is done. - */ - int n = thread_count; scm_thread *t; - SCM list = scm_c_make_list (n, SCM_UNSPECIFIED), *l; scm_i_pthread_mutex_lock (&thread_admin_mutex); - l = &list; + + int n = thread_count; + SCM list = scm_c_make_list (n, SCM_UNSPECIFIED); + SCM *l = &list; + for (t = all_threads; t && n > 0; t = t->next_thread) { - if (t != scm_i_signal_delivery_thread) + if (!t->exited + && (scm_is_false (scm_i_signal_delivery_thread) + || (!scm_is_eq (t->handle, scm_i_signal_delivery_thread)))) { SCM_SETCAR (*l, t->handle); l = SCM_CDRLOC (*l); @@ -1700,7 +1701,9 @@ SCM_DEFINE (scm_all_threads, "all-threads", 0, 0, 0, n--; } *l = SCM_EOL; + scm_i_pthread_mutex_unlock (&thread_admin_mutex); + return list; } #undef FUNC_NAME diff --git a/test-suite/standalone/Makefile.am b/test-suite/standalone/Makefile.am index 17bb59a18..ece0d7989 100644 --- a/test-suite/standalone/Makefile.am +++ b/test-suite/standalone/Makefile.am @@ -1,7 +1,6 @@ ## Process this file with automake to produce Makefile.in. ## -## Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -## 2011, 2012, 2013, 2014, 2020, 2021, 2022 Free Software Foundation, Inc. +## Copyright 2003-2014, 2020-2023 Free Software Foundation, Inc. ## ## This file is part of GUILE. ## @@ -96,6 +95,9 @@ EXTRA_DIST += test-language.el test-language.js check_SCRIPTS += test-guild-compile TESTS += test-guild-compile +check_SCRIPTS += test-sigaction-fork +TESTS += test-sigaction-fork + check_SCRIPTS += test-signal-fork TESTS += test-signal-fork diff --git a/test-suite/standalone/test-sigaction-fork b/test-suite/standalone/test-sigaction-fork new file mode 100755 index 000000000..25b62f1e7 --- /dev/null +++ b/test-suite/standalone/test-sigaction-fork @@ -0,0 +1,85 @@ +#!/bin/sh +exec guile -q -s "$0" "$@" +!# +;;; test-sigaction-fork --- Signal thread vs. fork, again. +;;; +;;; Copyright (C) 2024 Free Software Foundation, Inc. +;;; +;;; This library is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public +;;; License as published by the Free Software Foundation; either +;;; version 3 of the License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this library; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Test the bug described at : the signal +;;; thread would not be restarted after a call to 'primitive-fork', +;;; leading signals to be silently ignored. + +(use-modules (ice-9 match)) + +(define signals-handled + ;; List of signals handled. + '()) + +(define parent + ;; PID of the parent process. + (getpid)) + +(unless (provided? 'fork) + (exit 77)) + +;; This call spawns the signal delivery thread as a side effect. +(sigaction SIGALRM + (lambda (signal) + (call-with-blocked-asyncs + (lambda () + (set! signals-handled + (cons `(first-handler . ,(getpid)) + signals-handled)))))) + +(kill (getpid) SIGALRM) +(while (null? signals-handled) ;let the async run + (sleep 1)) + +(match (primitive-fork) + (0 + (pk 'child (getpid) signals-handled) + (kill (getpid) SIGALRM) ;first handler + (sleep 1) ;let the async run + (sigaction SIGALRM + (lambda (signal) + (call-with-blocked-asyncs + (lambda () + (set! signals-handled + (cons `(second-handler . ,(getpid)) + signals-handled)))))) + (kill (getpid) SIGALRM) ;second handler + (sleep 1) ;give asyncs one more chance to run + (format (current-error-port) "signals handled by the child + parent: ~s~%" + signals-handled) + (exit (equal? signals-handled + `((second-handler . ,(getpid)) + (first-handler . ,(getpid)) + (first-handler . ,parent))))) + + (child + (kill (getpid) SIGALRM) ;first handler + (sleep 1) ;give asyncs one more chance to run + (format (current-error-port) "signals handled by the parent: ~s~%" + signals-handled) + (exit (and (equal? signals-handled + `((first-handler . ,parent) + (first-handler . ,parent))) + (zero? (cdr (waitpid child))))))) + +;;; Local Variables: +;;; mode: scheme +;;; End: base-commit: a09214fb867846b12f1eb8ed91423636e511c1c7 -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 05 13:20:12 2024 Received: (at control) by debbugs.gnu.org; 5 Jan 2024 18:20:12 +0000 Received: from localhost ([127.0.0.1]:57852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLonj-0007xN-OT for submit@debbugs.gnu.org; Fri, 05 Jan 2024 13:20:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLonh-0007x3-Um for control@debbugs.gnu.org; Fri, 05 Jan 2024 13:20:10 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLonY-00049p-5V for control@debbugs.gnu.org; Fri, 05 Jan 2024 13:20:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=Af6mcE5CXrjM+t4Oj/8J6aAavuLu1nN0bwXbL9mqr60=; b=AdaZZtpULvIlbk HeHWrS1C0Nbg1izDc/8VgJHWv6sYDuehoHPeO5rmCeAPyzSu/+EXvZtW7fZs+DAAxCyaSTZfWgCuM Puk2iHEV+YreIlTRLXl+13G1SQym3INyKrvTfKmxhQYWCqUmEkr290jc1uLkXwhCo1wF+sVNp9sOy 7DODLDpnEuu6pe/YoQ3N9mzp9cjkVu5kgZsnmx4b2eD+gM/InOTkE1tJd/KzZC+TdkTo4SlzGf8bW 6RuXiOSWQmAbUS1p9QlEw41KqAmUbVhl30JubiXIvOMlp7UAuC0B4hEweBNY/0b5LpxIcFP6QWfnw llgPvudiDWMxKOKemuXg==; Date: Fri, 05 Jan 2024 19:19:57 +0100 Message-Id: <87mstjej76.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #68087 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 68087 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 24 05:35:13 2024 Received: (at 68087-done) by debbugs.gnu.org; 24 Jan 2024 10:35:13 +0000 Received: from localhost ([127.0.0.1]:44544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSabB-00053S-0j for submit@debbugs.gnu.org; Wed, 24 Jan 2024 05:35:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSab8-00053B-Em for 68087-done@debbugs.gnu.org; Wed, 24 Jan 2024 05:35:11 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSaax-0006S1-VG for 68087-done@debbugs.gnu.org; Wed, 24 Jan 2024 05:34:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=eXHKKirw2ULh6JrnKLvftieaf95U8IUMC00ej7p3GUI=; b=jYiIdtmSS0FscPdlUMRj xpp2FWhFRJKyWToWAeRSfs6NzGfFwLWDUiZdoM+UlPoaXIrxYb6tIT0tIUytKSgpAmp0DtlkBBRmD 4gH/ejkumDqHlke6uyrXSo8LcLgXCEjkDc2YbxBk2rvSOTm4I+X6JgQ+2d4zC1Ie2ykbwFggYYybv 4pxH1W8UHnl3AnZ5MuQbPdPTkOJMZ7e7ubcwojOD1UsvEqWbisy/w+ebJirM+Bx8EG3+bttYvfnQf Eou+Y+pPydAWRcFtuphDoRJGwGaBJmEqfa2RM8SUkmpkKXArC4e7OR9gUVmdmvwTormaWqSiN5x8K 4ILu8mM0nONv4g==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 68087-done@debbugs.gnu.org Subject: Re: bug#68087: Signal handlers not called after =?utf-8?Q?=E2=80=98primitive-fork=E2=80=99?= In-Reply-To: <20240105181404.2181-1-ludo@gnu.org> ("Ludovic =?utf-8?Q?Cour?= =?utf-8?Q?t=C3=A8s=22's?= message of "Fri, 5 Jan 2024 19:14:04 +0100") References: <87tto2gscb.fsf@inria.fr> <20240105181404.2181-1-ludo@gnu.org> Date: Wed, 24 Jan 2024 11:34:57 +0100 Message-ID: <87h6j3uii6.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68087-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s skribis: > Fixes . > > * libguile/scmsigs.h (scm_i_signals_pre_fork, scm_i_signals_post_fork): > New declarations. > (scm_i_signal_delivery_thread): Change type to SCM.. > * libguile/threads.c (scm_all_threads): Adjust accordingly and exclude > threads that have =E2=80=98t->exited=E2=80=99. Access =E2=80=98thread_co= unt=E2=80=99 after grabbing > =E2=80=98thread_admin_mutex=E2=80=99. > * libguile/posix.c (scm_fork): Add calls to =E2=80=98scm_i_signals_pre_fo= rk=E2=80=99 and > =E2=80=98scm_i_signals_post_fork=E2=80=99. > * libguile/scmsigs.c (signal_delivery_thread): Close signal_pipe[0] upon > exit and set it to -1. > (once): New file-global variable, moved from=E2=80=A6 > (scm_i_ensure_signal_delivery_thread): =E2=80=A6 here. > (stop_signal_delivery_thread, scm_i_signals_pre_fork) > (scm_i_signals_post_fork): New functions. > * test-suite/standalone/test-sigaction-fork: New file. > * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it. Pushed as 5a8502a4946e8a5b5c40a127aa240fc6ad960d03. Ludo=E2=80=99. From unknown Sat Sep 06 05:21:18 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 21 Feb 2024 12:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator