urllib.request.urlopen hangs for multiple minutes with timeout=30 and works with timeout=1
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
import urllib.request
urllib.request.urlopen(urllib.request.Request("https://pypi.org/pypi/MozPhab/json"), timeout=30)
Somehow this hangs, and Control+C doesn't stop it. The same URL loads instantly on Firefox and Node.js. Any help to investigate this further will be appreciated. (Could be related to #95838, except I don't have any VPN on this machine.)
Coming from https://bugzilla.mozilla.org/show_bug.cgi?id=1919884.
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the urllib.request.urlopen call with a Request for the pypi.org URL on Windows using Python 3.12, comparing timeout=30 with timeout=1. Read the related issue #95838 and investigate where the request stops responding; done means the long hang is explained and the reported behavior is fixed or clearly narrowed down.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100