undefined method 'ord' for nil:NilClass from Resolv methods when internet connection is lost
We experienced the following exception from a call to Resolv.getaddresses during a time when our local DNS resolver was available but the site's internet connection was cut off:
undefined method 'ord' for nil:NilClass
/usr/lib/ruby/2.0.0/resolv.rb:1446:in 'block (2 levels) in decode'
/usr/lib/ruby/2.0.0/resolv.rb:1445:in 'block in decode'
/usr/lib/ruby/2.0.0/resolv.rb:521:in 'block in each_resource'
/usr/lib/ruby/2.0.0/resolv.rb:1055:in 'block (3 levels) in resolv'
/usr/lib/ruby/2.0.0/resolv.rb:1053:in 'block (2 levels) in resolv'
/usr/lib/ruby/2.0.0/resolv.rb:1052:in 'block in resolv'
/usr/lib/ruby/2.0.0/resolv.rb:115:in 'block in each_address'
Perhaps @data is empty at this point?
This does not appear to be a new issue as I found https://github.com/ioquatix/rubydns/issues/20 which seems to be the same error (but on 1.9).
- lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise DecodeError if no data before the limit. Reported by Will Bryant. [Bug #9498]