Bug #9498

undefined method 'ord' for nil:NilClass from Resolv methods when internet connection is lost

Added by Will Bryant about 1 year ago. Updated about 1 year ago.

[ruby-core:60557]
Status:Closed
Priority:Normal
Assignee:-
ruby -v:ruby 2.0.0p353 (2013-11-22) [x86_64-linux] Backport:1.9.3: DONE, 2.0.0: DONE, 2.1: DONE

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).

Associated revisions

Revision 44884
Added by Akira Tanaka about 1 year ago

  • lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise DecodeError if no data before the limit. Reported by Will Bryant. [Bug #9498]

Revision 44884
Added by Akira Tanaka about 1 year ago

  • lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise DecodeError if no data before the limit. Reported by Will Bryant. [Bug #9498]

History

#1 Updated by Akira Tanaka about 1 year 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. [Bug #9498]

#2 Updated by Tomoyuki Chikanaga about 1 year 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

#3 Updated by Usaku NAKAMURA about 1 year ago

backported into ruby_1_9_3 at r44948.

#4 Updated by Usaku NAKAMURA about 1 year 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

#5 Updated by Tomoyuki Chikanaga about 1 year 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.

#6 Updated by Yui NARUSE about 1 year 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

Also available in: Atom PDF