Skip to content

fix: add timeout to urlopen#820

Merged
pawamoy merged 1 commit intomkdocstrings:mainfrom
smlloyd:fix-add-timeout
Apr 15, 2026
Merged

fix: add timeout to urlopen#820
pawamoy merged 1 commit intomkdocstrings:mainfrom
smlloyd:fix-add-timeout

Conversation

@smlloyd
Copy link
Copy Markdown
Contributor

@smlloyd smlloyd commented Apr 14, 2026

This prevents _download_url_with_gz from appearing to be hanging if e.g. the URL is blackholed. Without an explicit timeout, urlopen.request uses the global default timeout (socket.getdefaulttimeout()), which is None by default. This then leaves it up to the OS to decide how long to wait before giving up, which is typically too long for this purpose (e.g. ~127 seconds on Linux).

For reviewers

  • I did not use AI
  • I used AI and thoroughly reviewed every code/docs change

Description of the change

Use an explicit 10 seconds timeout.

Relevant resources

Closes #819

This prevents _download_url_with_gz from appearing to be hanging if e.g. the
URL is blackholed. Without an explicit timeout, `urlopen.request` uses the
global default timeout (`socket.getdefaulttimeout()`), which is `None`
by default. This then leaves it up to the OS to decide how long to wait
before giving up, which is typically too long for this purpose (e.g.
~127 seconds on Linux).
Copy link
Copy Markdown
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

@pawamoy pawamoy merged commit 3d1969a into mkdocstrings:main Apr 15, 2026
1 of 34 checks passed
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

Successfully merging this pull request may close these issues.

bug: build hangs if inventory can't be downloaded

2 participants