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

Fix DNS timeout issue #5

Open
calzoneman opened this issue Jan 22, 2015 · 1 comment
Open

Fix DNS timeout issue #5

calzoneman opened this issue Jan 22, 2015 · 1 comment
Labels

Comments

@calzoneman
Copy link
Owner

So I think I finally figured out what causes the mysterious issue where the script hangs (and thus your i3 statusbar is frozen and you're late because your clock is wrong), even though we're using the timeout parameter for requests.get(). The issue is that in some situations, it's not the HTTP request that is timing out, but the DNS lookup. In particular, this happens when I am connected to my home network, but the modem is unable to connect to the internet. I noticed that running python weather.py <woeid> without --wrap-i3-status under such circumstances isn't even interruptible with SIGINT.

It appears that someone else ran into this issue: https://github.com/kennethreitz/requests/issues/2347

Which was deemed as an issue with urllib3: http://bugs.python.org/issue22889

Which does not have a clear resolution in terms of what clients of requests should do, other than calling requests from a separate thread.

@kalgynirae What are your thoughts on this? The Python issue above mentions working around this with asyncio, with which I am not familiar.

@calzoneman calzoneman added the bug label Jan 22, 2015
@kalgynirae
Copy link
Collaborator

This does sound like a probable cause of the issue. I will look into whether it would be easy to use asyncio to do the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants