Issue #9498 has been updated by Yui NARUSE.

Backport changed from 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: DONE, 2.1: DONE

r45109

----------------------------------------
Bug #9498: undefined method 'ord' for nil:NilClass from Resolv methods wheninternet connection is lost
https://bugs.ruby-lang.org/issues/9498#change-45376

* Author: Will Bryant
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: current: 2.2.0
* ruby -v: ruby 2.0.0p353 (2013-11-22) [x86_64-linux]
* Backport: 1.9.3: DONE, 2.0.0: DONE, 2.1: DONE
----------------------------------------
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:1542:in 'get_labels'
/usr/lib/ruby/2.0.0/resolv.rb:1535:in 'get_name'
/usr/lib/ruby/2.0.0/resolv.rb:1568:in 'get_question'
/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 'each'
/usr/lib/ruby/2.0.0/resolv.rb:1445:in 'block in decode'
/usr/lib/ruby/2.0.0/resolv.rb:1470:in 'initialize'
/usr/lib/ruby/2.0.0/resolv.rb:1434:in 'new'
/usr/lib/ruby/2.0.0/resolv.rb:1434:in 'decode'
/usr/lib/ruby/2.0.0/resolv.rb:684:in 'request'
/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 'each'
/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 'each'
/usr/lib/ruby/2.0.0/resolv.rb:1052:in 'block in resolv'
/usr/lib/ruby/2.0.0/resolv.rb:1050:in 'each'
/usr/lib/ruby/2.0.0/resolv.rb:1050:in 'resolv'
/usr/lib/ruby/2.0.0/resolv.rb:513:in 'each_resource'
/usr/lib/ruby/2.0.0/resolv.rb:406:in 'each_address'
/usr/lib/ruby/2.0.0/resolv.rb:115:in 'block in each_address'
/usr/lib/ruby/2.0.0/resolv.rb:114:in 'each'
/usr/lib/ruby/2.0.0/resolv.rb:114:in 'each_address'
/usr/lib/ruby/2.0.0/resolv.rb:101:in 'getaddresses'
/usr/lib/ruby/2.0.0/resolv.rb:50:in 'getaddresses'

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 whichseems to bethe same error (but on 1.9).



-- 
http://bugs.ruby-lang.org/