public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-common 1/1] RESTEnvironment: periodically reap workers as SIGCHLD fallback
Date: Wed,  4 Mar 2026 14:46:48 +0100	[thread overview]
Message-ID: <20260304134649.82272-2-h.laimer@proxmox.com> (raw)
In-Reply-To: <20260304134649.82272-1-h.laimer@proxmox.com>

Libraries may temporarily override $SIG{CHLD}, causing worker exit
signals to be lost. Poll worker_reaper every 5 seconds via an AnyEvent
timer to catch any missed signals in API server contexts where this can
be problematic.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 src/PVE/RESTEnvironment.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 81d7e29..cb44823 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -37,6 +37,7 @@ my $rest_env;
 
 my $WORKER_PIDS;
 my $WORKER_FLAG = 0;
+my $worker_reaper_timer;
 
 my $log_task_result = sub {
     my ($upid, $user, $status) = @_;
@@ -124,6 +125,14 @@ sub init {
         }
     };
 
+    # Periodically reap workers as a fallback in case a library call temporarily overrides
+    # $SIG{CHLD} and causes us to miss a signal. Only useful when an event loop is running.
+    $worker_reaper_timer = AnyEvent->timer(
+        after => 5,
+        interval => 5,
+        cb => sub { $worker_reaper->() },
+    );
+
     # environment types
     # cli  ... command started fron command line
     # pub  ... access from public server (pveproxy)
-- 
2.47.3





  reply	other threads:[~2026-03-04 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 13:46 [PATCH access-control/common 0/2] address probblem with SIGCHLD handler being temporarily overwritten Hannes Laimer
2026-03-04 13:46 ` Hannes Laimer [this message]
2026-03-04 13:46 ` [PATCH pve-access-control 1/1] pam: fork for PAM authentication to isolate SIGCHLD handler Hannes Laimer

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=20260304134649.82272-2-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal