Bug? - Resolv.getnames hanging after being interrupted

Hi everybody,

I came across some weird behavior and I don’t know if it is a bug or
not. If you execute the following command it will run okay first, but
when Resolv.getnames gets interrupted by the timeout, it sometimes
stops working:

ruby -rresolv -e ‘1.upto(5) {begin; timeout(1) {1.upto(255) {|i| p [i, Resolv.getnames(“72.14.207.99”)] }}; rescue Timeout::Error; p “end”;
end}’

I have tested this on

  • Ubuntu 6.06 with ruby 1.8.4 (2005-12-24) [i486-linux] where it works
    fine
  • Ubuntu 6.06 with ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux]
    where it sometimes works but more often just hangs and does not
    resolve the ip anymore
  • Mac OSX 10.5.2 with ruby 1.8.6 (2007-09-23 patchlevel 110) [i686- darwin8.11.1] where it also hangs nearly every time

Resolv.getnames also sometimes stops working without being
interrupted, by just calling it a lot…

Maybe someone can shed some light on this?!

– Thomas