Skip Menu |

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

Report information
The Basics
Id: 71530
Status: resolved
Priority: 0/
Queue: Net-Async-HTTP

People
Owner: Nobody in particular
Requestors: rs [...] 474.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.12
Fixed in: 0.13



Subject: Some missed connection cache cleanups when no connection could be established
Hello again, when a request is made against a non-existent host, the module fails correctly with a resolver error. However, if the same request is tried again later, the on_response/on_error handlers are never called, since the failed connection is still in the cache, and no new one is going to be established to throw another error. This should be fixable by adding `delete $connections->{"$host:$port"}` statements to the on_resolve_error (and possibly on_connect_error) callbacks in lib/Net/Async/HTTP.pm line 190 ff. I tried it locally and it did fix the issue outlined above. thanks and regards, rs
Attached is a patch of how I resolved the issue locally.
Subject: resolve-error.patch
--- Net-Async-HTTP-0.12/lib/Net/Async/HTTP.pm 2011-09-30 10:30:53.000000000 +0000 +++ Net-Async-HTTP-0.12-resolve-fail/lib/Net/Async/HTTP.pm 2011-10-07 22:15:31.529589597 +0000 @@ -192,10 +192,12 @@ service => $port, on_resolve_error => sub { + delete $connections->{"$host:$port"}; $on_error->( "$host:$port not resolvable [$_[0]]" ); }, on_connect_error => sub { + delete $connections->{"$host:$port"}; $on_error->( "$host:$port not contactable" ); },
On Fri Oct 07 14:53:50 2011, PHAYLON wrote: Show quoted text
> This should be fixable by adding `delete $connections->{"$host:$port"}` > statements to the on_resolve_error (and possibly on_connect_error) > callbacks in lib/Net/Async/HTTP.pm line 190 ff.
And also the SSL failure case. Now patched upstream; will be in next release. I did consider how to unit test this one, but it's not really possible without some virtual testing support in IO::Async itself; which I have been considering adding sometime. So I might come back and unit-test this one better later. -- Paul Evans