Skip Menu |

This queue is for tickets about the MooseX-Daemonize CPAN distribution.

Report information
The Basics
Id: 85229
Status: resolved
Priority: 0/
Queue: MooseX-Daemonize

People
Owner: Nobody in particular
Requestors: chisel [...] chizography.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.17
Fixed in: (no value)



Subject: 'kill $pid' tests fail on a slow/loaded machine
I've been seeing a lot of failure for MooseX::Daemonize tests on our Jenkins build server. This seems to be because it can take more than two seconds to completely kill the process. I've attached a patch that will: - only sleep if it needs to (removing the existing mandatory 2 second sleep) - added a loop that will sleep for 2 seconds, up to 10 times and exit as soon as the $pid has been killed I hope the 20 seconds is enough for even sluggish systems.
Subject: MooseX-Daemonize-0.17-killpid.patch
diff -Naur MooseX-Daemonize-0.17/t/20.core.t MooseX-Daemonize-0.17-patch/t/20.core.t --- MooseX-Daemonize-0.17/t/20.core.t 2013-04-21 01:13:45.000000000 +0100 +++ MooseX-Daemonize-0.17-patch/t/20.core.t 2013-05-13 13:56:42.000000000 +0100 @@ -87,7 +87,14 @@ } kill INT => $p->pid; diag "killed $pid" if DEBUG; -sleep(2); + +# give the process time to be killed on slow/loaded systems +for (1..10) { + last unless kill 0 => $pid; + # sleep a little before retrying + sleep(2); +} + if (DEBUG) { diag `ps $pid`; diag "-------"; diff -Naur MooseX-Daemonize-0.17/t/21.core-back-compat.t MooseX-Daemonize-0.17-patch/t/21.core-back-compat.t --- MooseX-Daemonize-0.17/t/21.core-back-compat.t 2013-04-21 01:13:45.000000000 +0100 +++ MooseX-Daemonize-0.17-patch/t/21.core-back-compat.t 2013-05-13 13:56:45.000000000 +0100 @@ -88,7 +88,14 @@ } kill INT => $p->pid; diag "killed $pid" if DEBUG; -sleep(2); + +# give the process time to be killed on slow/loaded systems +for (1..10) { + last unless kill 0 => $pid; + # sleep a little before retrying + sleep(2); +} + if (DEBUG) { diag `ps $pid`; diag "-------"; diff -Naur MooseX-Daemonize-0.17/t/30.with_pid_file.t MooseX-Daemonize-0.17-patch/t/30.with_pid_file.t --- MooseX-Daemonize-0.17/t/30.with_pid_file.t 2013-04-21 01:13:45.000000000 +0100 +++ MooseX-Daemonize-0.17-patch/t/30.with_pid_file.t 2013-05-13 13:56:49.000000000 +0100 @@ -96,7 +96,14 @@ } kill INT => $p->pid; diag "killed $pid" if DEBUG; -sleep(2); + +# give the process time to be killed on slow/loaded systems +for (1..10) { + last unless kill 0 => $pid; + # sleep a little before retrying + sleep(2); +} + if (DEBUG) { diag `ps $pid`; diag "-------";
Thanks, released as v0.18.