public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/3] pvescheduler: catch errors in forked childs
Date: Thu, 18 Nov 2021 14:28:29 +0100	[thread overview]
Message-ID: <20211118132831.839774-1-d.csapak@proxmox.com> (raw)

if '$sub' dies, the error handler of PVE::Daemon triggers, which
initiates a shutdown of the child, resulting in confusing error logs
(e.g. 'got shutdown request, signal running jobs to stop')

instead, run it under 'eval' and print the error to the sylog instead

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/Service/pvescheduler.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/Service/pvescheduler.pm b/PVE/Service/pvescheduler.pm
index 9f5c4515..d4f73702 100755
--- a/PVE/Service/pvescheduler.pm
+++ b/PVE/Service/pvescheduler.pm
@@ -47,7 +47,12 @@ sub run {
 	    die "fork failed: $!\n";
 	} elsif ($child == 0) {
 	    $self->after_fork_cleanup();
-	    $sub->();
+	    eval {
+		$sub->();
+	    };
+	    if (my $err = $@) {
+		syslog('err', "ERROR: $err");
+	    }
 	    POSIX::_exit(0);
 	}
 
-- 
2.30.2





             reply	other threads:[~2021-11-18 13:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 13:28 Dominik Csapak [this message]
2021-11-18 13:28 ` [pve-devel] [PATCH manager 2/3] pvescheduler: reworking child pid tracking Dominik Csapak
2021-11-22  8:46   ` Fabian Ebner
2021-11-18 13:28 ` [pve-devel] [PATCH manager 3/3] pvescheduler: implement graceful reloading Dominik Csapak
2021-11-22 19:35 ` [pve-devel] applied-series: [PATCH manager 1/3] pvescheduler: catch errors in forked childs Thomas Lamprecht

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=20211118132831.839774-1-d.csapak@proxmox.com \
    --to=d.csapak@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