From e4af79e5130cad5cb506a12f5a40558bd43a3bf5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 11 Apr 2024 10:33:28 +0200 Subject: [PATCH] Bug 30897: Remove recursive parent identification loop We believe that plack will only spawn from one parent and children cannot spawn further child processes.. as such we don't need to walk up the tree. Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- Koha/Plugins.pm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index 88c51a5e6f..2b4c07956e 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -366,16 +366,9 @@ sub _restart_after_change { return unless ( C4::Context->config('plugins_restart') && C4::Context->psgi_env ); - my $parent_pid = getpid(); - my $ppid = getppid(); # Get the parent process ID + my $parent_pid = getppid(); - # If the current process is not Plack parent, find the parent process recursively - while ( $parent_pid != $ppid ) { - $parent_pid = $ppid; - $ppid = getppid(); - } - - # Send SIGUSR1 signal to Plack parent process for graceful restart + # Send HUP signal to Plack parent process for graceful restart kill 'HUP', $parent_pid; } -- 2.20.1