Skip Menu |

This queue is for tickets about the AnyEvent-Gearman CPAN distribution.

Report information
The Basics
Id: 91103
Status: open
Priority: 0/
Queue: AnyEvent-Gearman

People
Owner: Nobody in particular
Requestors: marius [...] ieval.ro
Cc:
AdminCc:

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



Subject: Test failure in t/04_reconnect.t
Date: Mon, 02 Dec 2013 00:21:46 +0200
To: bugs-AnyEvent-Gearman [...] rt.cpan.org
From: Marius Gavrilescu <marius [...] ieval.ro>
Hello AnyEvent::Gearman maintainers. I am packaging this module for Debian, but one of the tests in t/04_reconnect.t is failing. The make test output is:
PERL_DL_NONLAZY=3D1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harn= ess(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t t/00_compile.t ........ 1/? # Soft dependency versions: # Any::Moose: 0.21 # Mouse: 1.12 t/00_compile.t ........ ok=20=20=20 t/01_api.t ............ ok=20=20=20 t/02_client_worker.t .. ok=20=20=20 t/03_simple.t ......... ok=20=20=20 t/04_reconnect.t ...... 1/? Connection failed: Connection refused at /home/= marius/AnyEvent-Gearman-0.10/blib/lib/AnyEvent/Gearman/Connection.pm line 1= 12. # Failed test 'sum ok' # at t/04_reconnect.t line 59. # got: 'fail' # expected: '8' # Looks like you failed 1 test of 5. Unable to initialize connection to gearmand at /usr/share/perl5/Gearman/Wor= ker.pm line 116. t/04_reconnect.t ...... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/5 subtests=20 t/05_prefix.t ......... ok=20=20=20 t/09_constants.t ...... ok=20=20=20=20=20 Test Summary Report ------------------- t/04_reconnect.t (Wstat: 256 Tests: 5 Failed: 1) Failed test: 5 Non-zero exit status: 1 Files=3D7, Tests=3D58, 7 wallclock secs ( 0.07 usr 0.01 sys + 1.21 cusr = 0.14 csys =3D 1.43 CPU) Result: FAIL Failed 1/7 test programs. 1/58 subtests failed. make: *** [test_dynamic] Error 255
I have worked around this bug by adding a sleep statement, as seen in this patch:
Description: Fix t/04_reconnect.t The reconnect test fails due to a race condition. This patch sleeps for 7 seconds (randomly chosen), and the test passes. Author: Marius Gavrilescu <marius@ieval.ro> Forwarded: no Last-Update: 2013-10-24 --- a/t/04_reconnect.t +++ b/t/04_reconnect.t @@ -43,6 +43,7 @@ ok !$js->connected, 'disconnect ok'; $js->dead_time(0); # trick for reconnect soon + sleep 7; } {
This is definitely an inelegant solution. I am therefore looking for a better one, what would you suggest? -- Marius Gavrilescu
Download (untitled)
application/pgp-signature 835b

Message body not shown because it is not plain text.

I just looked up the cpantesters reports and found that 54 of 55 fails are due to "Connection refused". 397 PASSes indicate that something is definitely OK. Looking at who submitted the FAILs: one from Ryan Whitworth, all others from myself. So it seems like my smokers are set up in a way that promotes concurrency conflicts. Indeed, this is the case, my smokers are running cuncurrently. I'd love to see the FAILs go away, there's nothing more annoying than intermittent failure. I'm in favor of the change, I do not find it too ugly. But if it works, I'd prefer a sleep in the millisecond range.
Subject: Re: [rt.cpan.org #91103] Test failure in t/04_reconnect.t
Date: Wed, 25 Dec 2013 16:51:15 +0200
To: bug-AnyEvent-Gearman [...] rt.cpan.org
From: Marius Gavrilescu <marius [...] ieval.ro>
"Andreas Koenig via RT" <bug-AnyEvent-Gearman@rt.cpan.org> writes: Show quoted text
> But if it works, I'd prefer a sleep in the millisecond range.
A sleep of 0.001 seconds seems to be enough, confirmed by running 100 proves serially. If I run the 100 proves concurrently, the sleep needs to be a bit longer. If the sleep is 0.1s, the failure rate is about 4%. A sleep of 0.3s has no failures. Should I wait for a new release fixing this bug or should I release the current version with this patch?
Description: Fix t/04_reconnect.t The reconnect test fails due to a race condition. This patch sleeps for 7 seconds (randomly chosen), and the test passes. Author: Marius Gavrilescu <marius@ieval.ro> Forwarded: no Last-Update: 2013-12-25 --- a/t/04_reconnect.t +++ b/t/04_reconnect.t @@ -1,6 +1,7 @@ use Test::More; use Test::TCP; use AnyEvent::Gearman::Client; +use Time::HiRes qw/sleep/; eval q{ use Gearman::Worker; @@ -43,6 +44,7 @@ ok !$js->connected, 'disconnect ok'; $js->dead_time(0); # trick for reconnect soon + sleep 0.3; } {
-- Marius Gavrilescu
Download (untitled)
application/pgp-signature 835b

Message body not shown because it is not plain text.

I fixed it by putting Test::TCP::wait_port() instead which doesn't depend on arbitrary delays. See https://github.com/tokuhirom/Proc-Guard/pull/8 I'll release a trial version to smoke after a regression in Test-TCP-2.22 is fixed: https://github.com/tokuhirom/Test-TCP/pull/89 Note that Test::TCP isn't a newly introduced dependency.