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

feature request: add a timeout to DNS lookups #2347

Closed
kevinburke opened this issue Nov 17, 2014 · 5 comments

Comments

@kevinburke
Copy link
Contributor

@kevinburke kevinburke commented Nov 17, 2014

I don't think it's possible. But it would be nice.

Currently if:

  1. you set your DNS resolvers to something that's not listening on port 53, eg 123.123.123.123
  2. you try to make a request with a timeout

The request will use the system timeout, usually upwards of 2 minutes.

It would be nice to be able to attach a timeout to DNS lookups. Go attaches one for example by resolving DNS in a goroutine with a thread timeout.

@kevinburke

This comment has been minimized.

Copy link
Contributor Author

@kevinburke kevinburke commented Nov 17, 2014

in theory you could run the socket.connect() in a thread and time it out

@sigmavirus24

This comment has been minimized.

Copy link
Contributor

@sigmavirus24 sigmavirus24 commented Nov 17, 2014

Given that requests doesn't handle sockets itself, I think this is a feature you should be requesting in urllib3. Before you open an issue there, I wonder if @shazow would care to express their opinion here first.

@shazow

This comment has been minimized.

Copy link
Contributor

@shazow shazow commented Nov 17, 2014

I would love to have the ability to include a DNS timeout, but spawning a separate thread is not a viable option (for urllib3, at least).

@sigmavirus24

This comment has been minimized.

Copy link
Contributor

@sigmavirus24 sigmavirus24 commented Nov 17, 2014

So something that should probably be pushed upstream to bugs.python.org as a feature request and will have to be a 3.5+ only feature.

@kevinburke kevinburke closed this Nov 17, 2014
@kevinburke

This comment has been minimized.

Copy link
Contributor Author

@kevinburke kevinburke commented Nov 17, 2014

okay i submitted http://bugs.python.org/issue22889

Kevin Burke
phone: 925.271.7005 | twentymilliseconds.com

On Sun, Nov 16, 2014 at 9:19 PM, Ian Cordasco notifications@github.com
wrote:

So something that should probably be pushed upstream to bugs.python.org
as a feature request and will have to be a 3.5+ only feature.


Reply to this email directly or view it on GitHub
#2347 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.