Subject: | Incorrect can_read routine invoked, leading to timeouts |
Date: | Wed, 8 May 2013 12:25:55 +0100 |
To: | bug-Net-HTTP [...] rt.cpan.org |
From: | Richard Clayton <richard [...] highwayman.com> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I am using WWW::Mechanize and getting occasional and hard-to-reproduce
lockups...
... inspecting this I find that my program is stuck in
Net::HTTP::Methods::my_readline()
the flaw appears to be this line
die "read timeout" unless $self->can_read;
my $n = $self->sysread($_, 1024, length);
the invocation of can_read() does not pass any parameters
but the routine invoked (in my case) is
LWP::Protocol::http::SocketMethods::can_read()
which is in the ~~/Lib/LWP/Protocol/http.pm file
this starts
sub can_read {
my($self, $timeout) = @_;
ie: I end up with $timeout unset when the select() is invoked a few
lines thereafter -- and whatever funny state my connection is in does
not get timed out. Hence the lockup.
I suspect this might be the underlying cause of bug #81099 since they
report it was OK on #6.03 and my_readline() was recast in the current
form for #6.04
Clearly, upon inspection of the changes, the intent of the code is to
call the local routine can_read (slightly further down the Methods.pm
file).
I don't pretend to understand how Perl deals with overloaded routine
names (I always avoid them, and I always put () on calls for clarity
anyway) ... but I observe that simply converting the subroutine name to
kan_read makes my lockup go away (but then it was always rather
intermittent, so I haven't proved anything for sure).
I can provide more details about my setup if needed...
- --
Dr Richard Clayton <richard.clayton@cl.cam.ac.uk>
tel: 01223 763570, mobile: 07887 794090
Computer Laboratory, University of Cambridge, CB3 0FD
-----BEGIN PGP SIGNATURE-----
Version: PGPsdk version 1.7.1
iQA/AwUBUYo2Q+INNVchEYfiEQLtLQCeLG/L6f3dsByevA7TTNq0yEQjbLkAnj5f
nMYw7B4X+c2xh7/ftSWC0EAr
=d11G
-----END PGP SIGNATURE-----