perlbal fails on OSX

cremes.devlist at mac.com cremes.devlist at mac.com
Fri Apr 13 03:57:59 UTC 2007


I'm trying to get Perlbal 1.55 running on OSX (10.4.9). I'm using  
Danga::Socket 1.56 and all the latest releases of every other  
dependent package.

It passes every test except for one defined in 35-reproxy.t.

When running the tests with elevated verbosity, I get the following  
output (just an excerpt where it fails):

t/35-reproxy.............ok 1 - web servers started
beginning run
ok 2 - perlbal started
ok 3 - status response ok
ok 4 - file good via disk
ok 5 - file good via network
ok 6 - reproxy file
ok 7 - reproxy file
ok 8 - 2 on same conn
ok 9 - reproxy URL
ok 10 - response code is 200
ok 11 - reproxy URL
ok 12 - response code is 200
ok 13 - 4 on same conn
ok 14 - reproxy URL
ok 15 - 204 response code is 200
ok 16 - reproxy URL
ok 17 - 204 response code is 200
ok 18 - Prior to first hit, counter should be zero.
ok 19 - reproxy with cache: One
ok 20 - First hit to populate the cache.
ok 21 - reproxy with cache: Two
ok 22 - Second hit should be cached.
ok 23 - Prior to third hit, counter should still be 1.
ok 24 - reproxy with cache: Three
ok 25 - Third hit isn't cached, now 2.
ok 26 - reproxy with cache: Four
ok 27 - Forth hit should be cached again, still 2.
ok 28 - status ok
ok 29 - status ok
ok 30 - reproxy file
ok 31 - reproxy URL
ok 32 - response code is 200
ok 33 - status ok
ok 34 - reproxy URL
ok 35 - response code is 200
ok 36 - reproxy URL
ok 37 - response code is 200
ok 38 - reproxy file
ok 39 - reproxy file
ok 40 - reproxy URL
ok 41 - response code is 200
ok 42 - reproxy file
ok 43 - status ok
ok 44 - AIO mode none: 9 transitions
ok 45 - reproxy URL w/ dead one first

It hangs on the test given by this code:

# responses to HEAD requests should not have a body
{
     $wc->keepalive(0);
     my $resp = $wc->request({
         method => "HEAD",
     }, "reproxy_url:http://127.0.0.1:$webport/foo.txt");
     ok($resp && $resp->content eq '', "no response body when req  
method is HEAD");
     $wc->keepalive(1);
}

I did lots of debugging today and chased it down to the  
#resp_from_sock method in the ./lib/Perlbal/Test.pm module. The test  
above generates a HEAD request. Using a sniffer I see 3 total HEAD  
requests generated here:

HEAD http://127.0.0.1/reproxy_url:http://127.0.0.1:60002/foo.txt  200
HEAD http://127.0.0.1/reproxy_url:http://127.0.0.1:60002/foo.txt  204
HEAD http://127.0.0.1/foo.txt  200

The last packet contains a header where the Content-Length is set to  
31000 bytes. This packet causes the hang. The following code from  
Test.pm#resp_from_sock goes into an infinite loop:

     my $cl = $resp->header('Content-Length');
     if (defined $cl && $cl > 0) {
         my $content = '';
         while (($cl -= read($sock, $content, $cl)) > 0) {
             # assume an error means connection closed
             last if $!;
             # don't do anything, the loop is it
         }
         $resp->content($content);
     }

It sits in that while loop forever because there is no body attached  
(it's just a HEAD request) yet the Content-Length > 0.

I don't know why this hangs on OSX but doesn't hang on other systems.  
Anyone have a clue?

cr


More information about the perlbal mailing list