On Thu, Sep 10, 2009 at 05:43:50PM +0200, gregor herrmann wrote:
> On Wed, 09 Sep 2009 23:05:13 +0300, Niko Tyni wrote:
> 
> > > If I add "netbase" to the build deps, it still builds fine on i386,
> > > and now fails differently on amd64 (no warnings, only one failure,
> > > fails the 'other' test in this file):
> > 
> > >  #   Failed test 'Expected pause while connecting'
> > >  #   at t/05_reconnect_timeout.t line 24.
> > 
> > Can you reproduce this reliably?
> 
> Yes, if I run "-dh_auto_test" 10 times from debian/rules I get the
> same error 10 times.

This probably depends on the ISP routers. I'm seeing rate-limited ICMP
host unreachable messages when opening a TCP connection to 192.0.2.1, and
I managed to catch one of the failures with tcpdump + strace. Excerpts:

1..2
not ok 1 - Expected pause while connecting
#   Failed test 'Expected pause while connecting'
#   at t/05_reconnect_timeout.t line 22.
ok 2 - Should return fast on retry

13:31:45.886822 IP 192.168.234.150.34446 > 192.0.2.1.11211: S 
3164708393:3164708393(0) win 5840 <mss 1460,
sackOK,timestamp 1012516 0,nop,wscale 7>
13:31:45.943047 IP 139.97.3.82 > 192.168.234.150: ICMP host 192.0.2.1 
unreachable, length 36

8620  13:31:45.886757 connect(3, {sa_family=AF_INET, sin_port=htons(11211), 
sin_addr=inet_addr("192.0.2.1")}, 16) = -1 EINPROGRESS (Operation now in 
progress) <0.000172>
8620  13:31:45.887859 select(8, NULL, [3], NULL, {0, 250000}) = 1 (out [3], 
left {0, 196000}) <0.055230>
8620  13:31:45.943188 connect(3, {sa_family=AF_INET, sin_port=htons(11211), 
sin_addr=inet_addr("192.0.2.1")}, 16) = -1 EHOSTUNREACH (No route to host) 
<0.000014>

IOW, if the timing is right, the select() call in
Cache::Memcached::_connect_sock() that is expected to time out is
interrupted by the ICMP message. The subsequent connect() call gets
EHOSTUNREACH straight away and there is no 'pause while connecting'.

I'm sure there are different failure modes for this. Skipping this test
altogether for the Debian builds seems to make sense.

I'm attaching a patch that I think fixes all the issues discussed in
this report.
-- 
Niko Tyni   nt...@debian.org
diff --git a/debian/control b/debian/control
index a9ed83d..345e492 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Debian Perl Group <pkg-perl-maintain...@lists.alioth.debian.org>
 Uploaders: Jay Bonci <jaybo...@debian.org>, Jonathan Yu <freque...@cpan.org>
 Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: libstring-crc32-perl, perl (>= 5.6.0-16)
+Build-Depends-Indep: libstring-crc32-perl, perl (>= 5.6.0-16), netbase
 Standards-Version: 3.8.1
 Homepage: http://search.cpan.org/dist/Cache-Memcached/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libcache-memcached-perl/
diff --git a/debian/rules b/debian/rules
index 0d045f4..08aa1e8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,8 @@
 #!/usr/bin/make -f
 
+# used by t/05_reconnect_timeout.t
+export DEBIAN_BUILD = 1
+
 build: build-stamp
 build-stamp:
 	dh build
diff --git a/t/05_reconnect_timeout.t b/t/05_reconnect_timeout.t
index 4e8a223..28ba3d3 100644
--- a/t/05_reconnect_timeout.t
+++ b/t/05_reconnect_timeout.t
@@ -10,6 +10,9 @@ my $testaddr = "192.0.2.1:11211";
 
 plan tests => 2;
 
+SKIP: {
+    skip "Skipping network tests for Debian builds", 2 if $ENV{DEBIAN_BUILD};
+
 my $memd = Cache::Memcached->new({
     servers   => [ $testaddr ],
     namespace => "Cache::Memcached::t/$$/" . (time() % 100) . "/",
@@ -26,3 +29,5 @@ ok($time2 - $time1 > .1, "Expected pause while connecting");
 $memd->set("key", "foo");
 my $time3 = Time::HiRes::time();
 ok($time3 - $time2 < .1, "Should return fast on retry");
+
+} # SKIP
diff --git a/t/100_flush_bug.t b/t/100_flush_bug.t
index b660da0..0836f57 100644
--- a/t/100_flush_bug.t
+++ b/t/100_flush_bug.t
@@ -50,6 +50,10 @@ unless ($pid) {
     exit 0;
 }
 
+# wait for the child to get the server ready
+# see http://bugs.debian.org/545626
+sleep 1;
+
 my $memd = Cache::Memcached->new({ servers   => [ $testaddr ] });
 
 for (@res) {

Reply via email to