eallenvii has asked for the wisdom of the Perl Monks concerning the following question:
I understand that the usage of alarms like this is normal AND i believe at the time of this writing that IO::Socket::INET did not properly institute their Timeout argument, thus the original author used alarm.eval { local $SIG{ALRM} = sub { die 'timed out' }; alarm($connect_timeout); $socket = IO::Socket::INET->new( PeerAddr => $hostname, PeerPort => $port, Proto => 'tcp'); alarm(0); };
Note that the text 'timed out' is used later in the script to do some logic. This not only fixed the issue of the processes being fubar'ed from creating a future socket after a timeout, the timeouts just disappeared. In fact, i had to change what host it wanted to use to something that would drop packets and force a connection timed out.eval { local $SIG{ALRM} = sub { die 'timed out' }; # on any subsequent network/socket usage (if thread pr +eviously timeout) $socket = IO::Socket::INET->new( PeerAddr => $hostname, PeerPort => $port, Timeout => $connect_timeout, Proto => 'tcp'); };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Apache Processes Hung on Socket Issue
by vsespb (Chaplain) on Jul 03, 2013 at 20:33 UTC | |
by eallenvii (Novice) on Jul 03, 2013 at 23:13 UTC | |
by vsespb (Chaplain) on Jul 04, 2013 at 09:12 UTC | |
|
Re: Apache Processes Hung on Socket Issue
by andal (Hermit) on Jul 04, 2013 at 07:36 UTC | |
by hippo (Archbishop) on Jul 04, 2013 at 08:08 UTC |