Skip to content

fix: bound the connect timeout so it does not vary by platform - #7106

Open
Atishyy27 wants to merge 2 commits into
prefix-dev:mainfrom
Atishyy27:fix-connect-timeout
Open

Atishyy27 wants to merge 2 commits into
prefix-dev:mainfrom
Atishyy27:fix-connect-timeout

Conversation

@Atishyy27

Copy link
Copy Markdown
Contributor

Description

reqwest_client_builder sets a read timeout but no connect timeout, so the OS decides how long an unreachable host takes to fail, and that differs per platform. #6416 measured 2m02s on Linux against 5m03s on macOS for the same pixi search -c https://10.1.1.1 polars.

A connect timeout bounds establishing the connection, not the transfer, so it can be far shorter than the read timeout without hurting slow networks. 30 seconds is below the shortest platform default. I picked that number rather than finding it in the repo, so say if you want a different one.

Fixes #6416

How Has This Been Tested?

cargo test -p pixi_utils reqwest passes 10 of 10. The added test asserts the connect timeout is non-zero and shorter than the read timeout, since a value at or above it would never fire first. No network test, because with a 30 second default it would cost 30 seconds of CI wall clock.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient tests to cover my changes.

Atishyy27 and others added 2 commits September 27, 2026 20:08
Without an explicit connect timeout the OS default applies, so an unreachable channel hangs for roughly two minutes on Linux and five on macOS. Bound it at 30 seconds. This covers only establishing the connection, so the existing five minute read timeout still covers slow transfers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Inconsistent TCP Connection Timeout Behaviour

1 participant