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: Go's DNS resolver fails with no such host #15434
Comments
Can you share the output from running |
root@6515733c-cf49-4443-b7d9-adb073ea8885:~# dig registry-1.docker.io @10.155.248.190 ; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> registry-1.docker.io @10.155.248.190 ;; OPT PSEUDOSECTION: ;; Query time: 1 msec |
Interesting. With strace, can you tell if libc immediately tries the next nameserver, or does it continue waiting a bit longer before sending the next packet (e.g., calling poll(2) again)? Looking at libresolv's source, I'm wondering if you're hitting this code:
except that according to the dig output, anhp->arcount (aka "ADDITIONAL") should be 1. |
Here is the relevant strace from both go DNS
cgo DNS
|
Thanks! Looking at the DNS response header from 10.155.248.190 in the cgo strace output, it's clear that the response does actually have Replicating libresolv's behavior here seems easy, but feels kinda gross as it doesn't seem to be prescribed by the RFCs at all. FYI though, your netgo strace output looks incomplete though, like you're only tracing one of the OS threads. In particular, it's missing the I usually use |
I have a more more complete go trace with some editorials to trim the unwanted stuff.
|
@fraenkel Thanks, that looks more like what I would expect. I suspect the two connects are because we're issuing both A and AAAA queries, but the strace output is truncating the DNS packets so I can't see the QTYPE field. Anyway, I just uploaded https://go-review.googlesource.com/#/c/22428/, which I believe should fix the issue by replicating libresolv's behavior. Do you mind testing if it fixes your problem? |
It works. Thanks for the quick turnaround. |
CL https://golang.org/cl/22428 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go 1.6.2
go version devel +093ac15 Mon Apr 25 06:00:15 2016 +0000 linux/amd64
go env
)?linux amd64
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
http://play.golang.org/p/O1SMk6JM1w
success
Get http://registry-1.docker.io/v2: dial tcp: lookup registry-1.docker.io on 10.155.248.190:53: no such host
When I set export GODEBUG=netdns=cgo+1, I do succeed but with the default or setting it to go, I always get the no such host.
I have 3 DNS entries in my resolv.conf. The second and third entries can resolve the name.
With strace, I see that the cgo trace shows a request to each DNS resolver, however with Go, it only tries the first and fails.
The text was updated successfully, but these errors were encountered: