Skip to content
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: DNS lookup API with timeouts #4890

jmhodges opened this issue Feb 24, 2013 · 3 comments


None yet
4 participants
Copy link

commented Feb 24, 2013

Currently, there's no way to do a DNS lookup with a deadline or duration that the
request must finish within. This would be useful when the user wants to control DNS
lookups at a finer grained level separate from connections and requests. 

There is a lookupHostDeadline function in net/lookup.go, but it is not exposed to the

lookupHostDeadline has a TODO inside it to bring the deadlining down into the name
resolution functions themselves, so solving this issue could involve solving that. Even
an exposed API with the TODO in place would allow users to benefit from future fixes.

This is related to the now closed issue #2631.

This comment has been minimized.

Copy link

commented Feb 24, 2013

Comment 1:

There are nine Lookup functions in package net.  This would mean adding nine new
functions, taking timeouts.
To understand your motivation for wanting this, were you actually hitting problems with
the number of fds or threads for the DNS/cgo calls?
And which OS? On Linux at least we could use getaddrinfo_a (see and but even
that API doesn't really seem to do timeouts efficiently, probably because the underlying
NSS / resolver(3) mechanisms don't really support timeouts.
Your best bet probably is to not use the system's DNS facilities and use a pure Go DNS
resolver (maybe, which seems popular), where you'll have
more control.

Labels changed: added priority-someday, removed priority-triage.

Status changed to Thinking.


This comment has been minimized.

Copy link

commented Mar 12, 2013

Comment 2:

I really think using is your best bet. We don't even have timeout
control in package net on most systems since we're calling into the C library.

Labels changed: added priority-later, removed priority-someday, go1.1maybe.


This comment has been minimized.

Copy link

commented Jul 30, 2013

Comment 3:

Status changed to WontFix.

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.