Bug #9498
closedundefined method 'ord' for nil:NilClass from Resolv methods when internet connection is lost
Description
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 which seems to be the same error (but on 1.9).
Updated by akr (Akira Tanaka) almost 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r44884.
- lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
DecodeError if no data before the limit.
Reported by Will Bryant. [ruby-core:60557] [Bug #9498]
Updated by nagachika (Tomoyuki Chikanaga) almost 11 years ago
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED
Updated by usa (Usaku NAKAMURA) almost 11 years ago
backported into ruby_1_9_3 at r44948.
Updated by usa (Usaku NAKAMURA) almost 11 years ago
- Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: REQUIRED, 2.1: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) almost 11 years ago
- Backport changed from 1.9.3: DONE, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED
r44884 was backported to ruby_2_0_0 at r44976.
Updated by naruse (Yui NARUSE) almost 11 years ago
- 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