Skip Menu |
 

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 82375
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 6.04
Fixed in: (no value)



Subject: keep_alive + https == hangs until timeout
    use LWP::UserAgent;
    my($keep_alive, $url) = @ARGV;
    print LWP::UserAgent->new( keep_alive => $keep_alive, timeout => 10 )->get($url)->content
    __END__
    0 http://www.google.com works fine
    4 http://www.google.com works fine
    0 https://www.google.com works fine
    4 https://www.google.com times out but returns content

As demonstrated by the program above, and the various combinations of keep_alive and http vs https urls, when keep_alive is set LWP will hang retrieving an https URL until the timeout.  Then it will successfully return the content.

Its stuck on this line:

Net::HTTP::Methods::can_read(/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/Net/HTTP/Methods.pm:297):
297:            my $nfound = select($fbits, undef, undef, $timeout);

Here's the stack trace.

$ = Net::HTTP::Methods::can_read(ref(LWP::Protocol::https::Socket)) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/Net/HTTP/Methods.pm' line 257
$ = Net::HTTP::Methods::my_readline(ref(LWP::Protocol::https::Socket), 'Entity body') called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/Net/HTTP/Methods.pm' line 507
$ = Net::HTTP::Methods::read_entity_body(ref(LWP::Protocol::https::Socket), '', 4096) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/Protocol/http.pm' line 409
$ = LWP::Protocol::http::__ANON__[/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/Protocol/http.pm:420] called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/Protocol.pm' line 158
. = eval {...} called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/Protocol.pm' line 99
$ = LWP::Protocol::collect(ref(LWP::Protocol::https), undef, ref(HTTP::Response), ref(CODE)) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/Protocol/http.pm' line 420
$ = LWP::Protocol::http::request(ref(LWP::Protocol::https), ref(HTTP::Request), undef, undef, undef, 60) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/UserAgent.pm' line 192
. = eval {...} called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/UserAgent.pm' line 191
$ = LWP::UserAgent::send_request(ref(LWP::UserAgent), ref(HTTP::Request), undef, undef) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/UserAgent.pm' line 274
$ = LWP::UserAgent::simple_request(ref(LWP::UserAgent), ref(HTTP::Request), undef, undef) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/UserAgent.pm' line 282
$ = LWP::UserAgent::request(ref(LWP::UserAgent), ref(HTTP::Request)) called from file '/Users/schwern/perl5/perlbrew/perls/perl-5.16.2-threads/lib/site_perl/5.16.2/LWP/UserAgent.pm' line 410
$ = LWP::UserAgent::get(ref(LWP::UserAgent), 'https://www.google.com') called from -e line 1

perl 5.16.2 on OS X 10.8.2
LWP 6.04
LWP::Protocol::https 6.03
IO::Socket::SSL 1.81
Net::HTTPS 6.04
There is some discussion of a similar problem on StackOverflow which may be relevant.  http://stackoverflow.com/questions/9400068/make-timeout-work-for-lwpuseragent-https

$Net::HTTPS::SSL_SOCKET_CLASS is IO::Socket::SSL.  Net::HTTPS->can("blocking") points at IO::Socket::blocking().

Probable duplicate of https://rt.cpan.org/Ticket/Display.html?id=81237

DOY's fix works for me.
6.06 fixed this.


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.