Repository navigation
More retries for failed HTTP fetching - #17656
alan-rager-skydio wants to merge 3 commits into
Conversation
|
Hi, and thanks for contributing to uv! While we want something like this, it's hard to verify those changes at the scale of uv, which runs against all sorts of (misconfigured) network and registries. The core logic needs to hand-written, and needs to follow our existing style, e.g. can't use string contains checks for retry behavior and need to document the decision for the specific error types and status codes. We also want to avoid retrying in different places if possible, such as inside and outside the callback. |
Merging this PR will degrade performance by 7.12%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | resolve_warm_jupyter |
71.4 ms | 76.9 ms | -7.12% |
Comparing alan-rager-skydio:rager/rager/more-resilient-streams (65ba182) with main (7c74e08)
|
We can revisit this feature in the future. The easiest for us to adopt would be a library that is already used in other projects that implements stream retries, so we don't have to test run it in a critical part of uv. |
Summary
When downloading large packages over degraded connections, errors in downloading can end up not showing up until the unpacking stage of the pipeline, manifesting as
BufErrorthat can't be handled with retry mechanisms. See:Failed to download distributionswithunexpected BufErrorerrors #1710This is especially frustrating for downloads via HTTP Range requests. It seems like only the first request's status is actually taken into account in request retrying logic. To better handle them, the
Readeris wrapped to ensure that subsequent chunks can be retried. Additionally,BufErrorduring unpacking of archives triggers a restart of the download to try to push through connection issues.Test Plan
The network connection is artificially degraded to simulate the issues seen by people on unreliable WAN:
Then, a venv is created, and
torchis installed into it:Since this problem is mainly happening against our internal nexus repo, I'm having a tough time reproducing it against pypi but will see what I can do to induce the issue.