Project

General

Profile

Actions

Bug #911

closed

ArgumentError in Resolv#getaddress

Added by febuiles (Federico Builes) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
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
Actions #1

Updated by yugui (Yuki Sonoda) almost 16 years ago

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

=begin

=end

Actions #2

Updated by febuiles (Federico Builes) almost 16 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

Actions #3

Updated by antares (Michael Klishin) almost 16 years ago

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

Actions #4

Updated by febuiles (Federico Builes) almost 16 years ago

=begin

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

In article ,
Federico Builes 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
}
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for 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'
...

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

Actions #5

Updated by febuiles (Federico Builes) almost 16 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

Actions #6

Updated by febuiles (Federico Builes) almost 16 years ago

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

Actions #7

Updated by febuiles (Federico Builes) almost 16 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

Actions #8

Updated by akr (Akira Tanaka) almost 16 years ago

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

=begin

=end

Actions #9

Updated by shyouhei (Shyouhei Urabe) about 15 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

Actions #10

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

  • Status changed from Open to Assigned

=begin

=end

Actions #11

Updated by wyhaines (Kirk Haines) over 14 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0