Subject: | 'new' throws misleading 'croak' when open files limit exceeded |
Date: | Sat, 16 Jul 2016 22:53:08 -0400 |
To: | bug-IO-Socket-IP [...] rt.cpan.org |
From: | starlight.2016q3 [...] binnacle.cx |
While stress testing a high-capacity event-driven
script that issues larger numbers of asynchronous
Net::DNS::Resolver queries (in select-driven
bgsend/bgread style) hit upon the default
1024 open files limit (ulimit -HSn).
At line 936 of DNS-1.06/Resolver/Base.pm a call
to IO::Socket::IP->new() fails with the error
"Unrecognised protocol udp at Net/DNS/Resolver/Base.pm line 936"
which is actually thrown from
IO/Socket/IP-0.37.pm line 425
The error is misleading and without some previous
experience I would not have quickly figured out
the cause. Running the stress test after
ulimit -HSn 10240
worked correctly and without error. The problem
appears to be some kind of secondary consequence
of the resource exhaustion, though I did not
rigorously hunt down the precise chain of
cause-and-effect. Possibly the call to socket()
lacks complete error checking or contains a mistake.