Catch retries with wrapped reqwest errors#9253
Merged
charliermarsh merged 1 commit intomainfrom Nov 19, 2024
Merged
Conversation
charliermarsh
commented
Nov 19, 2024
| /// These cases should be safe to retry with [`Retryable::Transient`]. | ||
| pub(crate) fn is_extended_transient_error(err: &dyn Error) -> bool { | ||
| // First, look for `WrappedReqwestError`, which wraps `reqwest::Error` but doesn't always | ||
| // include it in the source. |
Member
Author
There was a problem hiding this comment.
We could also change WrappedReqwestError, it's a bit of a footgun, but I guess it's meant to replace reqwest::Error rather than wrap it further.
Member
There was a problem hiding this comment.
Yeah... idk. Both approaches seem to have downsides. I'd sort of rather fix the footgun but I'm not sure what other implications that has, presumably it affects the display in a problematic way?
Member
There was a problem hiding this comment.
WrappedReqwestError is a hack, if we have a better i'm all for it
Member
Author
There was a problem hiding this comment.
Yeah it looked sorta tricky. I can try though. I'll merge this for now.
zanieb
approved these changes
Nov 19, 2024
konstin
approved these changes
Nov 19, 2024
| /// These cases should be safe to retry with [`Retryable::Transient`]. | ||
| pub(crate) fn is_extended_transient_error(err: &dyn Error) -> bool { | ||
| // First, look for `WrappedReqwestError`, which wraps `reqwest::Error` but doesn't always | ||
| // include it in the source. |
Member
There was a problem hiding this comment.
WrappedReqwestError is a hack, if we have a better i'm all for it
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Nov 21, 2024
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.5.3` -> `0.5.4` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.5.4`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#054) [Compare Source](astral-sh/uv@0.5.3...0.5.4) ##### Enhancements - Accept either singular or plural values for CLI requirements ([#​9196](astral-sh/uv#9196)) - Add `--all-groups` to `uv sync`, `uv run`, `uv export`, and `uv tree` ([#​8892](astral-sh/uv#8892)) - Add a progress bar to `uv tree --outdated` and `uv pip list --outdated` ([#​9284](astral-sh/uv#9284)) - Add retries for Python downloads ([#​9274](astral-sh/uv#9274)) - Use exponential backoff for publish retries ([#​9276](astral-sh/uv#9276)) - Add manylinux target triples up to glibc 2.40 ([#​9234](astral-sh/uv#9234)) ##### Performance - Parallelize network requests in `uv tree --outdated` ([#​9280](astral-sh/uv#9280)) - Use `zlib-rs` on all platforms ([#​9264](astral-sh/uv#9264)) ##### Bug fixes - Avoid validating extra and group sources in `build-system.requires` ([#​9273](astral-sh/uv#9273)) - Catch retries with wrapped `reqwest` errors ([#​9253](astral-sh/uv#9253)) - Sort hashes in `uv export` output ([#​9237](astral-sh/uv#9237)) - Strip `--index` and `--default-index` from command header ([#​9288](astral-sh/uv#9288)) ##### Documentation - Add breadcrumbs to the documentation ([#​9242](astral-sh/uv#9242)) - Add minimum version to PyTorch guide ([#​9247](astral-sh/uv#9247)) - Add support for anchor redirects with client-side js ([#​9212](astral-sh/uv#9212)) - Improve content on project configuration ([#​9235](astral-sh/uv#9235)) - Improve the project creation documentation ([#​9236](astral-sh/uv#9236)) - Move the integration guides into the "Guides" section as a collapsed group ([#​9245](astral-sh/uv#9245)) - Reorganize the project concept documentation ([#​9121](astral-sh/uv#9121)) - Use the full screen height for the main content to stabilize the nav ([#​9153](astral-sh/uv#9153)) ##### Error messages - Add dedicated warning for empty stdin ([#​9256](astral-sh/uv#9256)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
It turns out that
WrappedReqwestErrorskips thereqwest::Erroritself in order to hack the display. This PR adds it to the list of variants we check when retrying transient errors.Closes #9246.
Test Plan
Patched
reqwestlocally to return an error inbytes(). Verified that it was not caught prior to this PR, but was caught afterwards.