Closed p5pRT closed 20 years ago
On linux 2.2.14 and presumably on other systems with SA_RESTART\, the timeout feature of IO::Socket->new() doesn't work. new() uses an alarm() to interrupt connect()\, however as "perldoc -f alarm" states it is necessary to use an eval/die to ensure the call to connect() is not restarted by the system.
This lack of timeout affects other modules such as LWP::UserAgent\, which won't respect its timeout setting due to this bug.
On a further note it seems a bit presumptuous of IO::Socket->new() to assume that there are no pending alarms on entry and that it can therefore do alarm(0) to cancel the alarm. It should take note of the return value from alarm() and reset the alarm there was an alarm pending on entry. I know this is a bit tricky to do right but general-purpose library code is a good place to do things right.
Thanks for listening.
Tom.
Migrated from rt.perl.org#2162 (status was 'resolved')
Searchable as RT2162$