public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children
@ 2026-06-10 11:35 Dominik Csapak
  2026-06-10 11:35 ` [RFC PATCH pmg-api 2/3] pmgpolicy: mimic Net::Server::PreForkSimple's signal handlers in child Dominik Csapak
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-10 11:35 UTC (permalink / raw)
  To: pmg-devel

Net::Server::PreForkSimple installs a handler for that in the parent
which reaps all children automatically with `waitpid(-1, ...)` and this
gets copied over on fork. Normally, the default `run_child` method sets
this back to the default, but in pmgpolicy that is overwritten and not
all signal handlers are set correctly.

This handler with its waitpid will be called before the one in
`run_command` which results in an error there.

To fix this, simply do what the default `run_child` does and set SIGCHLD
to 'DEFAULT'.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/bin/pmgpolicy | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/bin/pmgpolicy b/src/bin/pmgpolicy
index d7d440c..31bffe7 100755
--- a/src/bin/pmgpolicy
+++ b/src/bin/pmgpolicy
@@ -1002,6 +1002,8 @@ sub run_child {
         exit;
     };
 
+    $SIG{'CHLD'} = 'DEFAULT';
+
     delete $prop->{children};
 
     $self->child_init_hook;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC PATCH pmg-api 2/3] pmgpolicy: mimic Net::Server::PreForkSimple's signal handlers in child
  2026-06-10 11:35 [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Dominik Csapak
@ 2026-06-10 11:35 ` Dominik Csapak
  2026-06-10 11:35 ` [PATCH pmg-api 3/3] Revert "d/control: depend on proxmox-enterprise-support-keyring" Dominik Csapak
  2026-06-10 12:28 ` applied: [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Stoiko Ivanov
  2 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-10 11:35 UTC (permalink / raw)
  To: pmg-devel

In PreForkSimple's `run_child` method, some signal handlers are reset
that were copied over from the parent process. In pmgpolicy this method
gets overwritten and some handlers are overwritten like the default,
except SIGPIPE.

This shouldn't introduce any changes currently since it's set to IGNORE
in the parent already, but by mimicking the run_child behavior, we
protect against future changes when it might get set to something else
in the parent.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
sending as RFC because i'm currently not sure if it makes a difference
at all, but it seems like the correct approach, considering it's what
PreForkSimple also does.

 src/bin/pmgpolicy | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/pmgpolicy b/src/bin/pmgpolicy
index 31bffe7..e491d89 100755
--- a/src/bin/pmgpolicy
+++ b/src/bin/pmgpolicy
@@ -1003,6 +1003,7 @@ sub run_child {
     };
 
     $SIG{'CHLD'} = 'DEFAULT';
+    $SIG{'PIPE'} = 'IGNORE';
 
     delete $prop->{children};
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH pmg-api 3/3] Revert "d/control: depend on proxmox-enterprise-support-keyring"
  2026-06-10 11:35 [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Dominik Csapak
  2026-06-10 11:35 ` [RFC PATCH pmg-api 2/3] pmgpolicy: mimic Net::Server::PreForkSimple's signal handlers in child Dominik Csapak
@ 2026-06-10 11:35 ` Dominik Csapak
  2026-06-10 11:37   ` Dominik Csapak
  2026-06-10 12:28 ` applied: [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Stoiko Ivanov
  2 siblings, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2026-06-10 11:35 UTC (permalink / raw)
  To: pmg-devel

This reverts commit 84ecdc14a35fba4ba1bd512c56b28184f50cb511.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 debian/control | 1 -
 1 file changed, 1 deletion(-)

diff --git a/debian/control b/debian/control
index 9fdeccf..0d2567b 100644
--- a/debian/control
+++ b/debian/control
@@ -92,7 +92,6 @@ Depends: apt (>= 2~),
          postfix (>= 3.7.10),
          postgresql-17,
          proxmox-backup-client (>= 2.2.0),
-         proxmox-enterprise-support-keyring,
          proxmox-mini-journalreader (>= 1.3-1),
          proxmox-spamassassin (>= 4.0.0-2),
          proxmox-termproxy (>= 2.1.0),
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH pmg-api 3/3] Revert "d/control: depend on proxmox-enterprise-support-keyring"
  2026-06-10 11:35 ` [PATCH pmg-api 3/3] Revert "d/control: depend on proxmox-enterprise-support-keyring" Dominik Csapak
@ 2026-06-10 11:37   ` Dominik Csapak
  0 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-10 11:37 UTC (permalink / raw)
  To: pmg-devel

sorry, please disregard this 3/3 patch, i had this only to test the 
installation where that package was not yet available and forgot
to remove the commit before using git send-email...




^ permalink raw reply	[flat|nested] 5+ messages in thread

* applied: [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children
  2026-06-10 11:35 [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Dominik Csapak
  2026-06-10 11:35 ` [RFC PATCH pmg-api 2/3] pmgpolicy: mimic Net::Server::PreForkSimple's signal handlers in child Dominik Csapak
  2026-06-10 11:35 ` [PATCH pmg-api 3/3] Revert "d/control: depend on proxmox-enterprise-support-keyring" Dominik Csapak
@ 2026-06-10 12:28 ` Stoiko Ivanov
  2 siblings, 0 replies; 5+ messages in thread
From: Stoiko Ivanov @ 2026-06-10 12:28 UTC (permalink / raw)
  To: pmg-devel, Dominik Csapak

Thanks for the analysis and digging into this so quickly!

I gave it a spin on a reproducer of the issue (first only with your 1/3
and then additionally with your 2/3 applied) and it fixes the issue.

decided to apply both patches after looking through the commit-history of
pmgpolicy, and checking Net::Servers changes from a git-repository on
github [0] - it seems that the handling of SIGPIPE and SIGCHLD was added
at some point 2005 286cd15 ("fix signal handling"), while our
copy of run_child might have been copied off before that.
In any case it does not look like it was a deliberate decision to
keep the SIGCHLD handler from the parent.

I dropped the 3/3 that got sent by mistake.

[0]  https://github.com/rhandom/perl-net-server.git

On Wed, 10 Jun 2026 13:35:44 +0200, Dominik Csapak wrote:
> Net::Server::PreForkSimple installs a handler for that in the parent
> which reaps all children automatically with `waitpid(-1, ...)` and this
> gets copied over on fork. Normally, the default `run_child` method sets
> this back to the default, but in pmgpolicy that is overwritten and not
> all signal handlers are set correctly.
> 
> This handler with its waitpid will be called before the one in
> `run_command` which results in an error there.
> 
> [...]

Applied, thanks!

[1/3] pmgpolicy: fix failing run_command in children
      commit: 66d7976b9c73aacd94d0f66d5a28302a985cc5e5
[2/3] pmgpolicy: mimic Net::Server::PreForkSimple's signal handlers in child
      commit: c3b01e45d841e66779698fb03866fe5d397b56f3





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-10 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 11:35 [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Dominik Csapak
2026-06-10 11:35 ` [RFC PATCH pmg-api 2/3] pmgpolicy: mimic Net::Server::PreForkSimple's signal handlers in child Dominik Csapak
2026-06-10 11:35 ` [PATCH pmg-api 3/3] Revert "d/control: depend on proxmox-enterprise-support-keyring" Dominik Csapak
2026-06-10 11:37   ` Dominik Csapak
2026-06-10 12:28 ` applied: [PATCH pmg-api 1/3] pmgpolicy: fix failing run_command in children Stoiko Ivanov

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