-
Notifications
You must be signed in to change notification settings - Fork 18k
net: vague error message from Dial("tcp", "DNS reg-name") #14296
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
Comments
Do you have IPv6 connectivity? |
I had IPV6 so ifconfig output
Still same error with go1.6
|
Can you post |
No, the error messages are accurate. From go1.4.txt, you hit EMFILE:
And on Go 1.6, you hit:
If there's a bug here, it's not a regression in error messages about EMFILE. I'd fix your IPv6 connectivity first (either fully enable or fully disable) and then debug further. |
Can you confirm that the error is related to reaching number of open files? |
I can not. If the kernel is actually returning ENETUNREACH from connect instead of EMFILE, then there's nothing we can reasonably do. Or you're having network problems. Actually, I think you're just having network problems. Looking at your go1.6.txt, I never see an IPv6 connect succeed, but it tries. The DNS finds both IPv4 and IPv6 addresses, and the IPv4 ones succeed, wasting your file descriptors (since you never close anything, as you intended), and then eventually you see the errors from the IPv6 failures. You're probably hitting a Happy Eyeballs dial where both IPv6 and IPv4 are tried, and normally your IPv6 fails but it's okay because the IPv4 takes over, but in the final case your IPv6 fails and the IPv4 can't help take over because it's out of fds. In any case, you seem to be having network problems. I don't think the error message matters too much. But maybe @mikioh has other opinions. |
See https://golang.org/doc/go1.5#minor_library_changes. As described in the release notes like "The net package will now Dial hostnames by trying each IP address in order until one succeeds", from Go 1.5 Dial and its siblings do more work known as "connect by name" when you pass a destination "name." Also it requirse more file descriptors than Go 1.4 and below. Try the following snippet and variables:
I suppose that you may have various errors depending on the circumstances. Perhaps there's a room for improvement--reporting error values in dialing with "connect by name." |
I'll keep this issue open for someone who has a nice solution. |
@mikioh, I'm confused. What would you improve? Which error values are we not reporting? |
That's the problem. When the connect-by-name Dial faces multiple error values, which should be preferred? Or should we return nested, multiple error values? FWIW, it looks like current implementation prefers an error on primary destinations to backup destinations. |
Just FYI. The following tweak does affect nothing to the IPv6 node capability test in the net package,
because the test is a call like Listen("tcp6", "[::1]:0") for simplicity. Please do
instead. |
@mikioh Thanks for that
So i guess my IPv6 was always not working, but when IPv4 fails ( due to too many opened files ) it returns error from IPv6 Dial |
Merging this into #18183. |
simple app to reproduce error
This app doesn't close response.Body and leaves opened file descriptors.
go 1.4 returns correct error message, but go1.5 and 1.6 shows possibly confusing error message
The text was updated successfully, but these errors were encountered: