Project

General

Profile

Bug #911

ArgumentError in Resolv#getaddress

Added by febuiles (Federico Builes) almost 11 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
ruby -v:
ruby 1.8.6 (2009-08-05 patchlevel 384) [x86_64-linux]
[ruby-core:20723]

Description

=begin
Sometimes Resolv#getaddress fails with an ArgumentError when it should be raising a ResolvError:

$ ./irb
irb(main):001:0> require 'resolv'
=> true
irb(main):002:0> Resolv.getaddress("rewrq.rqweqwrw.rqww")
ArgumentError: wrong number of arguments (0 for 1)
from /usr/local/lib/ruby/1.8/resolv.rb:600:in initialize'
from /usr/local/lib/ruby/1.8/resolv.rb:600:in
exception'
from /usr/local/lib/ruby/1.8/resolv.rb:600:in raise'
from /usr/local/lib/ruby/1.8/resolv.rb:600:in
request'
from /usr/local/lib/ruby/1.8/resolv.rb:474:in each_resource'
from /usr/local/lib/ruby/1.8/resolv.rb:919:in
resolv'
from /usr/local/lib/ruby/1.8/resolv.rb:917:in each'
from /usr/local/lib/ruby/1.8/resolv.rb:917:in
resolv'
from /usr/local/lib/ruby/1.8/resolv.rb:916:in each'
from /usr/local/lib/ruby/1.8/resolv.rb:916:in
resolv'
from /usr/local/lib/ruby/1.8/resolv.rb:914:in each'
from /usr/local/lib/ruby/1.8/resolv.rb:914:in
resolv'
from /usr/local/lib/ruby/1.8/resolv.rb:466:in each_resource'
from /usr/local/lib/ruby/1.8/resolv.rb:422:in
each_address'
from /usr/local/lib/ruby/1.8/resolv.rb:249:in each_address'
from /usr/local/lib/ruby/1.8/resolv.rb:248:in
each'
from /usr/local/lib/ruby/1.8/resolv.rb:248:in each_address'
from /usr/local/lib/ruby/1.8/resolv.rb:232:in
getaddress'
from /usr/local/lib/ruby/1.8/resolv.rb:204:in getaddress'
irb(main):003:0> Resolv.getaddress("rewrq.rqweqwrw.rqww")
Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww
from /usr/local/lib/ruby/1.8/resolv.rb:233:in
getaddress'
from /usr/local/lib/ruby/1.8/resolv.rb:204:in `getaddress'
from (irb)

This affects Ruby 1.8 and 1.9
=end


Files

fix_resolv_timeout.patch (486 Bytes) fix_resolv_timeout.patch febuiles (Federico Builes), 12/23/2008 10:30 AM

Associated revisions

Revision 5b22d853
Added by wyhaines (Kirk Haines) over 9 years ago

Bug #911 [ruby-core:20723]; This bug, and occasional ArgumentError in Resolv#resolv, was caused by a resolution timeout.
The timeout would raise an Resolv::ResolvTimeout exception. Following the chain of ancestors backwards from there, one would arrive at Interrupt, which descended from Signal. Signal#initialize required an argument, and Interrupt's own #initialize likewise did so, but should not. The fix was to backport r12226 from the 1.8.7 branch, which fixes Interrupt#initialize. Fixing that clears this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1

Updated by yugui (Yuki Sonoda) almost 11 years ago

  • Category set to lib
  • Assignee set to akr (Akira Tanaka)
  • Target version set to 1.9.1 Release Candidate

=begin

=end

#2

Updated by febuiles (Federico Builes) almost 11 years ago

=begin

On Dec 21, 2008, at 9:44 AM, Tanaka Akira wrote:

Sometimes Resolv#getaddress fails with an ArgumentError when it

should be raising a ResolvError:

I couldn't reproduce the problem.

Please try to run the command several times in a row, it won't fail

every time so I think it might be a thread-related problem (although I

fail to see why it's triggered with only one address).

--
Federico

=end

#3

Updated by antares (Michael Klishin) almost 11 years ago

=begin
I could not reproduce it on 1.8.6p114 and 1.9.1 from today. I get ResolvError.
=end

#4

Updated by febuiles (Federico Builes) almost 11 years ago

=begin

On Dec 21, 2008, at 11:16 AM, Tanaka Akira wrote:

In article A639BCB0-455C-408D-B54B-6CE16EB4FA90@gmail.com,
Federico Builes federico.builes@gmail.com writes:

Please try to run the command several times in a row, it won't fail
every time so I think it might be a thread-related problem

(although I
fail to see why it's triggered with only one address).

I couldn't reproduce the problem even if it repeats 100 times.

The results after repeating it 10 times here:

irb(main):009:0> 10.times {
begin
Resolv.getaddress("rewrq.rqweqwrw.rqww")
rescue Resolv::ResolvError
p $!
end
}
#
#
#
#
#
#
#
ArgumentError: wrong number of arguments (0 for 1)
from /usr/local/lib/ruby/1.8/resolv.rb:600:in initialize'
from /usr/local/lib/ruby/1.8/resolv.rb:600:in
exception'
from /usr/local/lib/ruby/1.8/resolv.rb:600:in raise'
from /usr/local/lib/ruby/1.8/resolv.rb:600:in
request'
from /usr/local/lib/ruby/1.8/resolv.rb:474:in each_resource'
from /usr/local/lib/ruby/1.8/resolv.rb:919:in
resolv'
from /usr/local/lib/ruby/1.8/resolv.rb:917:in each'
from /usr/local/lib/ruby/1.8/resolv.rb:917:in
resolv'
from /usr/local/lib/ruby/1.8/resolv.rb:916:in `each'
...

Any ideas of what might be triggering it? This happens in 1.8.6p287

and 1.9 HEAD under OS X 10.5.5

--
Federico

=end

#5

Updated by febuiles (Federico Builes) almost 11 years ago

=begin

On Dec 21, 2008, at 11:55 AM, James Gray wrote:

On Dec 21, 2008, at 10:50 AM, Federico Builes wrote:

Any ideas of what might be triggering it? This happens in 1.8.6p287

and 1.9 HEAD under OS X 10.5.5

I'm wondering if the difference that makes it happen or not happen

is related to how Ruby is compiled. For example, if pthread was

used or not. Just a wild guess…

I'm compiling like this:

  $ ./configure --with-readline-dir=/usr/local/lib
  $ make
  $ make install

pthread support is not enabled (segfaults when I try to use it: http://gist.github.com/38721)
.

--
Federico

=end

#6

Updated by febuiles (Federico Builes) almost 11 years ago

=begin
Turns out that TimeoutError was missing the message, I'm attaching the path to fix this in 1.9.
=end

#7

Updated by febuiles (Federico Builes) almost 11 years ago

=begin
Tanaka Akira writes:

In article ,

Turns out that TimeoutError was missing the message, I'm attaching the path to fix this in 1.9.

I don't understand why it fix the problem.

"raise ResolvTimeout" doesn't cause ArgumentError.

You're right, I was testing against an older 1.9 that
still expected a message passed to TimeoutError. Please disregard this issue
for 1.9.

The issue still exists in 1.8.6 and I can't get a clean run of 1.8.7
(Malformed Mach-o file) so please let me know if you need patches for these
versions. If not please close this ticket.

--
Federico

=end

#8

Updated by akr (Akira Tanaka) almost 11 years ago

  • Assignee changed from akr (Akira Tanaka) to shyouhei (Shyouhei Urabe)

=begin

=end

#9

Updated by shyouhei (Shyouhei Urabe) over 10 years ago

  • Assignee changed from shyouhei (Shyouhei Urabe) to wyhaines (Kirk Haines)
  • ruby -v set to ruby 1.8.6 (2009-08-05 patchlevel 384) [x86_64-linux]

=begin
According to [ruby-core:20821], this issue is 1.8.6 specific.
=end

#10

Updated by marcandre (Marc-Andre Lafortune) about 10 years ago

  • Status changed from Open to Assigned

=begin

=end

#11

Updated by wyhaines (Kirk Haines) over 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28029.
Federico, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF