-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: Dial always query DNS for both A and AAAA even if network is tcp4 or tcp6 when pure Go resolver is used #45024
Labels
Milestone
Comments
Change https://golang.org/cl/301709 mentions this issue: |
Here is my test code: (build it with package main
import "net"
func main() {
net.Dial("tcp4", "golang.org:80")
} Dump from wireshark:
|
cherrymui
changed the title
net.Dial always query DNS for both A and AAAA even if network is tcp4 or tcp6 when pure Go resolver is used
net: Dial always query DNS for both A and AAAA even if network is tcp4 or tcp6 when pure Go resolver is used
Mar 15, 2021
cherrymui
added
the
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
label
Mar 15, 2021
cc @bradfitz |
cc @ekalinin |
odeke-em
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
labels
Mar 23, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
When pure Go resolver is used, net.Dial always send two DNS query (one for A record and another for AAAA), even if the
network
parameter set to one oftcp4
,tcp6
,udp4
,udp6
. This will add extra latencies when making IPv4-only or IPv6-only connections. In the worst case, for example, a pure IPv4 host with firewall filtered out all AAAA queries, a dial withtcp4
will have to wait 10 second until AAAA query timed out.The same problem was also found in cgo resolver (#25947), and it was fixed in c659be4.
My pull request will fix this.
The text was updated successfully, but these errors were encountered: