public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH librados2-perl 2/3] reset inherited signal handlers in child worker
Date: Tue,  8 Aug 2023 13:23:11 +0200	[thread overview]
Message-ID: <20230808112312.64667-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230808112312.64667-1-f.ebner@proxmox.com>

For example, if pvestatd is the parent, the inherited signal handlers
from pvestatd, i.e. PVE/Daemon.pm's handlers would be invoked by the
child.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 PVE/RADOS.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PVE/RADOS.pm b/PVE/RADOS.pm
index 162e7db..41b9c39 100644
--- a/PVE/RADOS.pm
+++ b/PVE/RADOS.pm
@@ -201,6 +201,11 @@ sub new {
 	    &$atfork();
 	}
 
+	# override signal handlers inherited from the parent
+	local $SIG{HUP} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
+	    exit(1);
+	};
+
 	# fixme: timeout?
 
 	close $child;
-- 
2.39.2





  parent reply	other threads:[~2023-08-08 11:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 11:23 [pve-devel] [PATCH-SERIES librados2-perl] improve fork behavior Fiona Ebner
2023-08-08 11:23 ` [pve-devel] [PATCH librados2-perl 1/3] refactor pverados worker into dedicated function Fiona Ebner
2023-08-08 11:23 ` Fiona Ebner [this message]
2023-08-08 11:23 ` [pve-devel] [PATCH librados2-perl 3/3] use POSIX::_exit instead of exit in forked child Fiona Ebner
2023-08-11  7:13 ` [pve-devel] applied-series: [PATCH-SERIES librados2-perl] improve fork behavior Wolfgang Bumiller

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=20230808112312.64667-3-f.ebner@proxmox.com \
    --to=f.ebner@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