[Melbourne-pm] LWP/https timeout issue

Bradley Dean bjdean at bjdean.id.au
Sat Jan 3 03:15:10 PST 2009


Hi Paul,

On Tue, Dec 30, 2008 at 11:34:57AM +1100, Paul Dwerryhouse wrote:
> I've run across a small issue when using LWP with https connections, in that
> it completely ignores the 'timeout' parameter.

I've come across this sort of behaviour. As a I recall the problem is that
the timeout is not measured across the entire request. Once a connection is
established the timeout will trigger if there is a delay in data being sent
by the server.

The POD hints at this: " ... This means that the time it takes for the
complete transaction and the request() method to actually return might be
longer."

> To complicate matters, I'm not calling LWP directly, but rather using it
> via SOAP::Lite:
> 
> $soap_conn = SOAP::Lite
>         ->uri('url:Blah::Handler')
>         ->proxy('https://localhost:81/blah',timeout => 5);
> 
> $response = $soap_conn->function(
> 	SOAP::Data->name('param' => 'whatever'))->result;

My solution was to use SIGALRM (perldoc -f alarm) to force a timeout on the
section of the code that made the request. Given that your request is
inside SOAP::Lite this approach might also make sense because it's a
timeout on the overall process, not just the HTTP request part.

Cheerio,

 Brad

-- 
Bradley Dean
Software Engineer - http://bjdean.id.au/
Email: bjdean at bjdean.id.au Skype: skype at bjdean.id.au
Mobile(Aus): +61-413014395 Mobile(UK): +44-7846895073


More information about the Melbourne-pm mailing list