-
-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
In HEAD (after 1.73.1), recent changes to add_config_nameservers appear to have created a race condition when making 2 or more parallel queries across threads or fibers.
Running on HEAD, but with the add_config_nameservers from 1.73.1 works, and is what was actually tested for the "1.73.1" column below.
The error exposes itself 2 different ways depending on the nature of the Resolver config.
| resolver | 1.37.1 | HEAD |
|---|---|---|
| r1 (default config) | works | ArgumentError: No valid nameservers found in config |
r2 (with :config_info) |
works | Dnsruby::ResolvTimeout: Query timed out |
Reproduction script:
#!/usr/bin/env ruby
$: << './lib'
require 'dnsruby'
# without config options
# 1st query (A) works
# 2nd query (AAAA) raises: ArgumentError: No valid nameservers found in config
# note: this runs add_config_nameservers 2x in my environment
# there are 2x 'nameserver x.x.x.x' in my resolv.conf (1 ip4, 1 ip6); unsure if related
r1 = Dnsruby::Resolver.new
# with config_info
# 1st query (A) works
# 2nd query (AAAA) raises: Dnsruby::ResolvTimeout: Query timed out
# note: this runs add_config_nameservers 1x in my environment
r2 = Dnsruby::Resolver.new(
config_info: {
# contents here doesn't matter; even setting to {} is enough to cause ResolvTimeout
apply_domain: false,
apply_search_list: false,
},
query_timeout: 3, # make the timeout faster
)
{r1:, r2:}.each do |name, r|
puts "#{name} ----"
%w(A AAAA).map do |type|
Thread.new do
ans = r.query('a.root-servers.net.', type).answer
puts "#{'%-4s' % type}: #{ans.join}"
rescue
puts "Exception for #{type}: #{$!.inspect}"
end
end.map(&:join)
endPerhaps the whole set of work from creating PacketSender's to assigning @single_resolvers to error checking all need to be wrapped inside the mutex again?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels