-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: DialTimeout is not able to connect when /etc/resolv.conf has some unreachable nameservers at the top #57694
Comments
Try with running it with Also note that resolv.conf has a limit of 3 resolvers. man resolv.conf(5):
|
(CC @ianlancetaylor @neild) |
I added the 4th entry just to observe the behavior and to verify that Go code is actually reading all 3 entries. When I added debugging logs to the functions in net package, I can see that for some lookups it is attempting to connect to all 3 name servers, however functions seem to return with the timeout from the first entry. In order to isolate the problem, I wrapped the net.DialTimeout call as follows with driver main.go program.
|
The timeout you provide as a argument causes a creation of a internal context inside the net package, which is passed to the address resolution. Lines 393 to 399 in 261fe25
I feel that it works as intended. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
We have a small helper function like this:
This function gets the error "dial tcp: lookup zts.athens.yahoo.com: i/o timeout", when /etc/resolv.conf has nameservers that are not reachable at the top.
For ex:
What did you expect to see?
Go resolver code to continue to try a nameserver that is reachable and pick up the answer. For example, nslookup or dig don't have any issue in resolving the names when an unreachable nameserver is at the top in /etc/resolve.conf
What did you see instead?
We are getting at timeout, possibly after trying the nameservers that are not reachable.
The text was updated successfully, but these errors were encountered: