Skip Menu |
 

This queue is for tickets about the POE-Component-Client-Keepalive CPAN distribution.

Report information
The Basics
Id: 98644
Status: new
Priority: 0/
Queue: POE-Component-Client-Keepalive

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

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

Attachments
0001-Fix-a-race-in-t-10_resolver.t.patch



Subject: 'second request honored asynchronously' t/10_resolver.t test fails
Download (untitled) / with headers
text/plain 1011b
The 'second request honored asynchronously' t/10_resolver.t test fails on a slow host: $ prove -l -v t/10_resolver.t t/10_resolver.t .. 1..6 ok 1 - first request honored asynchronously ok 2 - first request not from cache ok 3 - first request from internal resolver not ok 4 - second request honored asynchronously ok 5 - second request not from cache ok 6 - second request from external resolver # Failed test 'second request honored asynchronously' # at t/10_resolver.t line 83. # Looks like you failed 1 test of 6. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/6 subtests This is a race between reusing an TCP connection and a keep-a-live timeout set to 120 s in the library. The bug can be reproduced by adding "sleep 130;" into t/10_resolver.t at beginning of got_conn() subroutine. The 0.272 release reworded the message (second request connect error 110: Connection timed out), but the issue is still there. I recommend to skip the affected tests if the test run time exceeds the time-out.
From: ppisar [...] redhat.com
Download (untitled) / with headers
text/plain 184b
Dne Pá 05.zář.2014 09:36:21, ppisar napsal(a): Show quoted text
> I recommend to skip the affected tests if the test run time exceeds > the time-out.
Attached patch implements the idea. -- Petr
Subject: 0001-Fix-a-race-in-t-10_resolver.t.patch
From 460aea659bc8d7d2d15aa68b873bb171e4f4a44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Fri, 5 Sep 2014 16:39:27 +0200 Subject: [PATCH] Fix a race in t/10_resolver.t 'second request honored asynchronously' t/10_resolver.t fails on a very slow machine. There is a race between reusing a TCP connection and a keep-a-live timeout set to 120 s in the library. The bug can be reproduced by adding "sleep 130;" into t/10_resolver.t at beginning of got_conn() subroutine. This patch will kips the test if test run time exceeds the timeout. --- t/10_resolver.t | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/t/10_resolver.t b/t/10_resolver.t index 5c5e734..38ea52d 100644 --- a/t/10_resolver.t +++ b/t/10_resolver.t @@ -20,6 +20,8 @@ use TestServer; my $server_port = TestServer->spawn(0); my $test_server_use_count = 0; +my $timeout = 120; +my $start; POE::Session->create( inline_states => { @@ -41,6 +43,7 @@ POE::Session->create( sub start_with { my $heap = $_[HEAP]; + $start = time; $_[KERNEL]->alias_set ('WITH'); $heap->{cm} = POE::Component::Client::Keepalive->new( @@ -53,6 +56,7 @@ sub start_with { port => $server_port, event => "got_conn", context => "first", + timeout => $timeout, ); ++$test_server_use_count; @@ -72,6 +76,7 @@ sub start_without { port => $server_port, event => "got_conn", context => "second", + timeout => $timeout, ); ++$test_server_use_count; @@ -88,14 +93,19 @@ sub got_conn{ my $connection = delete $response->{connection}; my $which = $response->{context}; - if (defined $connection) { - pass "$which request honored asynchronously"; - } - else { - fail( - "$which request $response->{function} error $response->{error_num}: " . - $response->{error_str} - ); + SKIP: { + if ($which eq 'second' and time - $start >= $timeout) { + skip "Test run time exceded keepalive timeout $timeout s", 1; + } + if (defined $connection) { + pass "$which request honored asynchronously"; + } + else { + fail( + "$which request $response->{function} error $response->{error_num}: " . + $response->{error_str} + ); + } } ok( -- 2.1.0


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.