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

Map hangs if Internet drops out #18

Open
e100 opened this issue Sep 24, 2021 · 3 comments
Open

Map hangs if Internet drops out #18

e100 opened this issue Sep 24, 2021 · 3 comments

Comments

@e100
Copy link

e100 commented Sep 24, 2021

If Internet connection is disrupted when the map is updating it can hang forever.
The default timeout with urllib is no timeout.
Apparently the only way to set it is to set the default socket timeout like:
socket.setdefaulttimeout(30)
Seems like it would be a good idea to set the default timeout in all code that makes requests using urllib to prevent this hang.

Reference:
https://python.readthedocs.io/en/stable/howto/urllib2.html#sockets-and-layers

@markyharris
Copy link
Owner

Great catch. I never would have considered that. I'll test it out shortly.

@e100
Copy link
Author

e100 commented Apr 26, 2024

I added timeout option to urlopen and so far that seems to have prevented any hangs:

content = urllib.request.urlopen(url, timeout=30 ).read()

@markyharris
Copy link
Owner

Thank Eric, I'll incorporate your change in my development unit.

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

No branches or pull requests

2 participants