Fix DNS resolution randomly failing#41
Fix DNS resolution randomly failing#41grogers0 wants to merge 1 commit intojruby:masterfrom grogers0:master
Conversation
|
Hi there. This is an issue with the MRI standard library. As such, please take up the issue to the core team. http://redmine.ruby-lang.org/ |
|
I'm not sure this is an issue with the MRI library -- the SocketError comes from JRuby's socket implementation :( Anyway, I monkey-patched this one for myself by rescuing the SocketError when it could not bind. |
|
jruby-1.7.9 :002 > require 'socket' |
When resolving DNS, the current code picks a random udp port and tries to bind to it to use for the DNS request. If the port it chooses is already in use, a SocketError is raised (Unlike in regular Ruby where Errno::EADDRINUSE is raised, and a new random port is chosen). Fix by letting the OS choose a random port that is not in use for us.