public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/3] pvescheduler: catch errors in forked childs
@ 2021-11-18 13:28 Dominik Csapak
  2021-11-18 13:28 ` [pve-devel] [PATCH manager 2/3] pvescheduler: reworking child pid tracking Dominik Csapak
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dominik Csapak @ 2021-11-18 13:28 UTC (permalink / raw)
  To: pve-devel

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





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

end of thread, other threads:[~2021-11-22 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 13:28 [pve-devel] [PATCH manager 1/3] pvescheduler: catch errors in forked childs Dominik Csapak
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

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