Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 9026
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: ajsavige [...] yahoo.com.au
Cc:
AdminCc:

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



Subject: Test t/local/back.t hangs on Windows XP
When installing WWW-Mechanize-1.06 with perl-5.8.6, the test t/local/back.t hangs on my Windows XP SP2 box as follows: 1..38 ok 1 - use WWW::Mechanize; ok 2 - The object isa WWW::Mechanize ok 3 - this $mech starts with a cookie jar # Started local server on http://localhost:10039/ ok 4 - The object isa LocalServer ok 5 - Fetched OK ok 6 - Followed OK ok 7 - Did the base get set back? ok 8 - Title set back? ok 9 - Followed OK ok 10 - Did the base get set back? ok 11 - Title set back? ok 12 - Pre-search check ok 13 - Searched for Perl ok 14 - Right page title ok 15 - POST is in the stack ok 16 - HEAD succeeded ok 17 - HEAD is not in the stack ok 18 - Back ok 19 - Did the base get set back? ok 20 - Title set back? ok 21 - Post-search check ok 22 - reload() does not push page to stack ok 23 - $mech still has a cookie jar after a number of back() ok 24 # skip Test::Memory::Cycle not installed ok 25 - The object isa WWW::Mechanize ok 26 - Got root URL ok 27 - Pre-404 check The machine hangs at this point; there are two blocked perl processes which must now be manually killed. After doing some tracing, I discovered what was going on. After doing the fork(), one thread does a: $server404->accept() Now, as soon as this accept() executes, any subsequent call to getsockname() on the accepting socket (from the other thread) hangs. And in the line: $mech->get($server404->url); the $server404->url call eventually calls getsockname() under the covers. Not sure if this is a perl/Windows bug or perhaps a "feature" of emulating fork() with threads (??). In any case, a simple remedy, as shown in the patch below, is to call (and save) $server404->url before doing the fork: --- t/local/back-orig.t 2004-11-04 15:15:33.000000000 +1100 +++ t/local/back.t 2004-12-20 17:15:44.000000000 +1100 @@ -123,6 +123,7 @@ is( scalar @{$mech->{page_stack}}, 0, "Pre-404 check" ); my $server404 = HTTP::Daemon->new or die; +my $svr404url = $server404->url; die "Cannot fork" if (! defined (my $pid404 = fork())); END { @@ -140,7 +141,7 @@ } } -$mech->get($server404->url); +$mech->get($svr404url); is( $mech->status, 404 , "404 check"); is( scalar @{$mech->{page_stack}}, 1, "Even 404s get on the stack" ); The test now passes. Though the full test suite now passes, an annoying error message is generated at the end of t/local/back.t as follows: "Couldn't remove tempfile C:\TMP\bKa0NNY8Ti : Permission denied" /-\
Fixed in 1.11_02.