You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed the lookup function loops over all resolvers in resolv.conf despite the Dial function having been overridden.
This leads to the number of retries to be correlated to the number of entries in resolv.conf without actually using these resolv.conf servers since the Dial function is overridden.
What did you expect to see?
I would have expected the (r *Resolver) lookup function to not fetch resolv.conf configuration when the Dial function has been overridden with a custom server.
Also I would have expected the number of servers in resolv.conf to not influence the number of retries.
What did you see instead?
With 3 resolvers in resolv.conf, I am seeing 6 retries total (3 * 2)
21:25:00.403789 IP 10.0.2.15.38464 > 1.2.3.4.53: 16792+ NS? cloudflare.com. (32)
21:25:05.404578 IP 10.0.2.15.36711 > 1.2.3.4.53: 53187+ NS? cloudflare.com. (32)
21:25:10.410653 IP 10.0.2.15.48693 > 1.2.3.4.53: 10620+ NS? cloudflare.com. (32)
21:25:15.418829 IP 10.0.2.15.42359 > 1.2.3.4.53: 44619+ NS? cloudflare.com. (32)
21:25:20.425065 IP 10.0.2.15.39995 > 1.2.3.4.53: 9573+ NS? cloudflare.com. (32)
21:25:25.431093 IP 10.0.2.15.41456 > 1.2.3.4.53: 36792+ NS? cloudflare.com. (32)
With 2 resolvers in resolv.conf (I deleted server 1.1.1.1), I am seeing 4 retries total (2 *2)
21:26:22.121101 IP 10.0.2.15.48327 > 1.2.3.4.53: 57107+ NS? cloudflare.com. (32)
21:26:27.126828 IP 10.0.2.15.42868 > 1.2.3.4.53: 61507+ NS? cloudflare.com. (32)
21:26:32.132852 IP 10.0.2.15.39008 > 1.2.3.4.53: 2860+ NS? cloudflare.com. (32)
21:26:37.145549 IP 10.0.2.15.51778 > 1.2.3.4.53: 2160+ NS? cloudflare.com. (32
In both cases the program completes with the following error that contains the wrong server (8.8.4.4:53 isn't actually used, see #43703)
lookup cloudflare.com on 8.8.4.4:53: read udp 10.0.2.15:41456->1.2.3.4:53: i/o timeout
Feel free to let me know if you need any other information, thank you!
The text was updated successfully, but these errors were encountered:
Given how this works, resolver gives Dial an address and expects an associated conn back, I would consider this to be working as intended, if unfortunate for this particular situation. There is no way for resolver to know what Dial did to choose an address to attempt to connect to.
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?
Create a Resolver, override its
Dial
function to set a fixed resolver ip to be used:1.2.3.4:53
.Set
resolv.conf
to beUse it to resolve cloudflare.com NS.
Source code
I have noticed the
lookup
function loops over all resolvers inresolv.conf
despite theDial
function having been overridden.This leads to the number of retries to be correlated to the number of entries in
resolv.conf
without actually using theseresolv.conf
servers since theDial
function is overridden.What did you expect to see?
I would have expected the
(r *Resolver) lookup
function to not fetchresolv.conf
configuration when theDial
function has been overridden with a custom server.Also I would have expected the number of servers in
resolv.conf
to not influence the number of retries.What did you see instead?
With 3 resolvers in resolv.conf, I am seeing 6 retries total (3 * 2)
With 2 resolvers in resolv.conf (I deleted
server 1.1.1.1
), I am seeing 4 retries total (2 *2)In both cases the program completes with the following error that contains the wrong server (
8.8.4.4:53
isn't actually used, see #43703)Feel free to let me know if you need any other information, thank you!
The text was updated successfully, but these errors were encountered: