Skip Menu |
 

This queue is for tickets about the HTTP-Async CPAN distribution.

Report information
The Basics
Id: 33071
Status: open
Priority: 0/
Queue: HTTP-Async

People
Owner: Nobody in particular
Requestors: my.tranquil [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.09
Fixed in: (no value)



Subject: Timeout param doesn't work
Download (untitled) / with headers
text/plain 1.3k
Hi, i've started using the module a few days ago and noticed that it doesn't use the timeout param, and actually there isn't a way to change the default 180 value. init the module: my $asyncAgent = HTTP::Async->new; $asyncAgent->timeout ( 10 ); add request my $request = HTTP::Request->new( "GET", "http://92.112.219.158" ); my $reqID = $asyncAgent->add( $request ); here is waits 180 sec and doesn't timeout after 10 as specified. i've debugged the problem and stepped into the code, while comparing it to lwp-useragent. i've found that when a new INET module is being created, the arg{Timeout} param isn't transferred to the class, thus not updating the new value to 10. eventually when Socket is initialied: sub new { my($class,%arg) = @_; my $sock = $class->SUPER::new(); $sock->autoflush(1); ##### here $are{Timeout} is EMPTY..... ############## ${*$sock}{'io_socket_timeout'} = delete $arg{Timeout}; ###################################################### return scalar(%arg) ? $sock->configure(\%arg) : $sock; } i'm not entirely sure how the flow works and how can i add the timeout value... hope you will see it better than i do. Distribution ver: HTTP::Async 0.09 Perl version: v5.8.8 built for x86_64-linux-thread-multi OS: 2.6.20-1.2320.fc5 x86_64 GNU/Linux (Fedora Core 5)
From: my.tranquil [...] gmail.com
Download (untitled) / with headers
text/plain 1.8k
On Sun Feb 10 05:02:25 2008, eyale wrote: Show quoted text
> Hi, > > i've started using the module a few days ago and noticed that it doesn't > use the timeout param, and actually there isn't a way to change the > default 180 value. > > init the module: > my $asyncAgent = HTTP::Async->new; > $asyncAgent->timeout ( 10 ); > > add request > my $request = HTTP::Request->new( "GET", "http://92.112.219.158" ); > my $reqID = $asyncAgent->add( $request ); > > here is waits 180 sec and doesn't timeout after 10 as specified. > > i've debugged the problem and stepped into the code, while comparing it > to lwp-useragent. > i've found that when a new INET module is being created, the > arg{Timeout} param isn't transferred to the class, thus not updating the > new value to 10. > > eventually when Socket is initialied: > > sub new { > my($class,%arg) = @_; > my $sock = $class->SUPER::new(); > > $sock->autoflush(1); > > ##### here $are{Timeout} is EMPTY..... ############## > ${*$sock}{'io_socket_timeout'} = delete $arg{Timeout}; > ###################################################### > > return scalar(%arg) ? $sock->configure(\%arg) > : $sock; > } > > > i'm not entirely sure how the flow works and how can i add the timeout > value... > > hope you will see it better than i do. > > Distribution ver: HTTP::Async 0.09 > Perl version: v5.8.8 built for x86_64-linux-thread-multi > OS: 2.6.20-1.2320.fc5 x86_64 GNU/Linux (Fedora Core 5)
I belive i've solved the bug, with one more line added to the _send_request method. after the following lines: $args{Host} = $uri->host; $args{PeerAddr} = $self->_get_opt( 'proxy_host', $id ); $args{PeerPort} = $self->_get_opt( 'proxy_port', $id ); i added this line: ## ADDED BY EDRI - TIMEOUT ERROR $args{Timeout} = $self->_get_opt ( 'timeout', $id); and it started to use the given timeout param.
Subject: Re: [rt.cpan.org #33071] Timeout param doesn't work
Date: Tue, 19 Feb 2008 13:41:53 +0000
To: bug-HTTP-Async [...] rt.cpan.org
From: "Edmund von der Burg" <evdb [...] ecclestoad.co.uk>
Download (untitled) / with headers
text/plain 2.3k
great stuff - I'm hoping to sit down and get all the recent suggestions into the code so that I can release a new version - thanks for the patch. Cheers, Edmund. On 13/02/2008, eyal edri via RT <bug-HTTP-Async@rt.cpan.org> wrote: Show quoted text
> > Queue: HTTP-Async > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=33071 > > > On Sun Feb 10 05:02:25 2008, eyale wrote:
> > Hi, > > > > i've started using the module a few days ago and noticed that it doesn't > > use the timeout param, and actually there isn't a way to change the > > default 180 value. > > > > init the module: > > my $asyncAgent = HTTP::Async->new; > > $asyncAgent->timeout ( 10 ); > > > > add request > > my $request = HTTP::Request->new( "GET", "http://92.112.219.158" ); > > my $reqID = $asyncAgent->add( $request ); > > > > here is waits 180 sec and doesn't timeout after 10 as specified. > > > > i've debugged the problem and stepped into the code, while comparing it > > to lwp-useragent. > > i've found that when a new INET module is being created, the > > arg{Timeout} param isn't transferred to the class, thus not updating the > > new value to 10. > > > > eventually when Socket is initialied: > > > > sub new { > > my($class,%arg) = @_; > > my $sock = $class->SUPER::new(); > > > > $sock->autoflush(1); > > > > ##### here $are{Timeout} is EMPTY..... ############## > > ${*$sock}{'io_socket_timeout'} = delete $arg{Timeout}; > > ###################################################### > > > > return scalar(%arg) ? $sock->configure(\%arg) > > : $sock; > > } > > > > > > i'm not entirely sure how the flow works and how can i add the timeout > > value... > > > > hope you will see it better than i do. > > > > Distribution ver: HTTP::Async 0.09 > > Perl version: v5.8.8 built for x86_64-linux-thread-multi > > OS: 2.6.20-1.2320.fc5 x86_64 GNU/Linux (Fedora Core 5)
> > I belive i've solved the bug, with one more line added to the > > _send_request method. > > after the following lines: > $args{Host} = $uri->host; > $args{PeerAddr} = $self->_get_opt( 'proxy_host', $id ); > $args{PeerPort} = $self->_get_opt( 'proxy_port', $id ); > > i added this line: > > ## ADDED BY EDRI - TIMEOUT ERROR > $args{Timeout} = $self->_get_opt ( 'timeout', $id); > > and it started to use the given timeout param. > > >
-- evdb@ecclestoad.co.uk - http://ecclestoad.co.uk
Just checking to see if there is any update on when this change might make it into a release.


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.