From 49ebe2ba26d7a73d7be6c1a24ffa03942e400c08 Mon Sep 17 00:00:00 2001 From: Marc Soda Date: Fri, 3 Feb 2017 15:11:20 -0500 Subject: [PATCH 1/2] check for pid file first --- lib/FCGI/Engine/ProcManager.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/FCGI/Engine/ProcManager.pm b/lib/FCGI/Engine/ProcManager.pm index cabb6e6..5c69bd3 100644 --- a/lib/FCGI/Engine/ProcManager.pm +++ b/lib/FCGI/Engine/ProcManager.pm @@ -334,8 +334,10 @@ sub die : method { $SIG{HUP} = 'DEFAULT'; $SIG{TERM} = 'DEFAULT'; - $self->pidfile->remove - || $self->notify("Could not remove PID file: $!"); + if ($self->pidfile->does_file_exist) { + $self->pidfile->remove + || $self->notify("Could not remove PID file: $!"); + } # prepare to die no matter what. if (defined $self->die_timeout) { From e751f5d3c97425604399036bbd7d0f6019d83a05 Mon Sep 17 00:00:00 2001 From: Marc Soda Date: Fri, 3 Feb 2017 15:12:09 -0500 Subject: [PATCH 2/2] add pm_exit --- lib/Plack/Handler/FCGI/Engine/ProcManager.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Plack/Handler/FCGI/Engine/ProcManager.pm b/lib/Plack/Handler/FCGI/Engine/ProcManager.pm index 07b2ae1..e14c2dd 100644 --- a/lib/Plack/Handler/FCGI/Engine/ProcManager.pm +++ b/lib/Plack/Handler/FCGI/Engine/ProcManager.pm @@ -18,6 +18,7 @@ has 'pidfile' => ( sub pm_manage { (shift)->manage( @_ ) } sub pm_pre_dispatch { (shift)->pre_dispatch( @_ ) } sub pm_post_dispatch { (shift)->post_dispatch( @_ ) } +sub pm_exit { (shift)->die( @_ ) } sub notify { my ($self, $msg) = @_;