Skip Menu |

This queue is for tickets about the IO-Socket-IP CPAN distribution.

Report information
The Basics
Id: 103878
Status: resolved
Priority: 0/
Queue: IO-Socket-IP

People
Owner: Nobody in particular
Requestors: develop [...] traveljury.com
Cc:
AdminCc:

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



Subject: Core::connect() doesn't respect Timeout
When trying to connect to a non-existent service, the Timeout parameter is not respected, eg: $i=IO::Socket::IP->new( 'KeepAlive' => 1, 'PeerHost' => '127.0.0.2', 'PeerPort' => 9200, 'Proto' => 'tcp', 'Timeout' => 2, 'Type' => 1 ) The above call hangs for about 30 seconds in perl 5.20.0 and 5.20.2, but previously would timeout after 2 seconds.
Just to clarify: Show quoted text
> 'PeerHost' => '127.0.0.2',
This was tested on OSX where 127.0.0.2 is not the same as 127.0.0.1. On linux you may see slightly different results. However, the bug remains with any API address that can't be connected to. I had a bug report for the Search::Elasticsearch module caused by this issue: https://github.com/elastic/elasticsearch-perl/issues/70#issuecomment-113613877 This bug causes serious issues for users of my module - instead of being able to timeout connects to bad IPs quickly and move on to other live hostnames, it introduces a thirty second delay which can bring an entire website grinding to a halt.
On Wed Apr 22 06:20:46 2015, DRTECH wrote: Show quoted text
> The above call hangs for about 30 seconds in perl 5.20.0 and 5.20.2, > but previously would timeout after 2 seconds.
You don't mention which version of IO::Socket::IP you tested this on. The timeout logic around connect was last touched for the release of 0.32, with various bugfixes in 0.33, 0.34, and 0.35. Can you retest with 0.35 or later; or confirm that it was already tested there? -- Paul Evans
If I remember correctly, this was with whichever version that shipped with perl 5.20 Just tried it in 0.37 and it works correctly. thanks, I'll close