Project

General

Profile

Actions

Bug #8285

closed

Resolv::DNS: TCP fallback fails with multiple resolvers

Added by julian.mehnle (Julian Mehnle) about 11 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin11]
Backport:
[ruby-core:<unknown>]

Description

Since my TCP fallback support patch from #3835 was merged Resolv::DNS would sometimes fail with a @"host/port don't match: :"@ @Resolv::DNS::Requester::RequestError@ exception in @resolv.rb@, line 818 (Ruby 1.9.1). This happens when more than one nameserver is configured and Resolv::DNS is has fallen back to TCP and rotates from the first to the second nameserver (e.g., when there was a timeout in the TCP query to the first nameserver).


Files

ruby-trunk-8285-resolv-tcp-fallback-fix.diff (2.51 KB) ruby-trunk-8285-resolv-tcp-fallback-fix.diff julian.mehnle (Julian Mehnle), 04/18/2013 07:36 AM

Updated by julian.mehnle (Julian Mehnle) about 11 years ago

The problem is caused by my original TCP fallback code reusing a Resolv::DNS::Requester::TCP::Sender object that was initialized for one (the first) nameserver with a Resolv::DNS::Requester::TCP object that was initialized for another (the second) nameserver, and the TCP requester detecting a host/port mismatch between itself and the sender. (The fact that both the requester and the sender are aware of the nameserver's host and port is a design bug in the original code, but I opted not to fix that.)

This patch fixes my original TCP fallback code to keep one sender per requester, thereby avoiding mismatch situations. (Also this patch gracefully handles the nameserver refusing a TCP connection (raised as an Errno::ECONNREFUSED exception) by treating it like a timeout.)

Updated by julian.mehnle (Julian Mehnle) about 11 years ago

Why has @monospace@ formatting been disabled in this Redmine? Bleh!

Updated by julian.mehnle (Julian Mehnle) about 11 years ago

Also, ruby -v actually is: ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin11]

Updated by akr (Akira Tanaka) about 10 years ago

After ruby-trunk-8285-resolv-tcp-fallback-fix.diff is applied,
lib/resolv.rb has a syntax error.

% ruby -c lib/resolv.rb
lib/resolv.rb:524: syntax error, unexpected tOP_ASGN
protocol  = protocols[candidate| ||= :udp
                                    ^

Updated by akr (Akira Tanaka) about 10 years ago

  • Status changed from Open to Feedback
Actions #6

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

  • Status changed from Feedback to Closed
  • Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0