From e39dc9f830f7175a84ad03ddb21bd452177a3f59 Mon Sep 17 00:00:00 2001 From: brsakai-csco <127449361+brsakai-csco@users.noreply.github.com> Date: Fri, 9 Jun 2023 09:00:37 -0400 Subject: [PATCH] Do not send redundant SIGQUITs If the worker reports itself as shutting down, do not send a SIGQUIT to the worker. It already knows it is shutting down, and this can cause a race with signal handlers that can trigger core dumps. --- lib/Mojo/Server/Prefork.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Mojo/Server/Prefork.pm b/lib/Mojo/Server/Prefork.pm index 2586379030..35a649125a 100644 --- a/lib/Mojo/Server/Prefork.pm +++ b/lib/Mojo/Server/Prefork.pm @@ -181,7 +181,10 @@ sub _wait { while ($chunk =~ /(\d+):(\d)\n/g) { next unless my $w = $self->{pool}{$1}; @$w{qw(healthy time)} = (1, $time) and $self->emit(heartbeat => $1); - $w->{graceful} ||= $time if $2; + if ($2) { + $w->{graceful} ||= $time; + $w->{quit}++; + } } }