From 84eaf9c6670e270641378de39e45632b2da2a57d Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 18 Nov 2021 14:28:29 +0100 Subject: [PATCH] pvescheduler: catch errors in forked childs 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 --- 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.39.5