Skip to content

Comments

Show when we retried requests#4725

Merged
konstin merged 3 commits intomainfrom
konsti/log-retries
Jul 2, 2024
Merged

Show when we retried requests#4725
konstin merged 3 commits intomainfrom
konsti/log-retries

Conversation

@konstin
Copy link
Member

@konstin konstin commented Jul 2, 2024

In #3514 and #2755, users had intermittent network errors, but it was not always clear whether we had already retried these requests or not. Building upon TrueLayer/reqwest-middleware#159, this PR adds the number of retries to the error message, so we can see at first glance where we're missing retries and where we might need to change retry settings.

Example error trace:

Could not connect, are you offline?
  Caused by: Request failed after 3 retries
  Caused by: error sending request for url (https://pypi.org/simple/uv/)
  Caused by: client error (Connect)
  Caused by: dns error: failed to lookup address information: Name or service not known
  Caused by: failed to lookup address information: Name or service not known

This code is ugly since i'm missing a better pattern for attaching context to reqwest middleware errors in TrueLayer/reqwest-middleware#159.

In #3514 and #2755, users had intermittent network errors, but it was not always clear whether we had already retried these requests or not. Building upon TrueLayer/reqwest-middleware#159, this PR adds the number of retries to the error message, so we can see at first glance where we're missing retries and where we might need to change retry settings.

Example error trace:

```
Could not connect, are you offline?
  Caused by: Request failed after 3 retries
  Caused by: error sending request for url (https://pypi.org/simple/uv/)
  Caused by: client error (Connect)
  Caused by: dns error: failed to lookup address information: Name or service not known
  Caused by: failed to lookup address information: Name or service not known
```

This code is ugly since i'm missing a better pattern for attaching context to reqwest middleware errors in TrueLayer/reqwest-middleware#159.
@konstin konstin added network Network connectivity e.g. proxies, DNS, and SSL tracing Verbose output and debugging error messages Messaging when something goes wrong and removed tracing Verbose output and debugging labels Jul 2, 2024
@zanieb
Copy link
Member

zanieb commented Jul 2, 2024

Should we wait to merge until we're off the git-deps?

@konstin
Copy link
Member Author

konstin commented Jul 2, 2024

I haven't gotten any feedback from the maintainers yet and i want to ship this in uv so we get better user reports for network failures.

@zanieb
Copy link
Member

zanieb commented Jul 2, 2024

👍 Can we open an issue to track moving them into the Astral org then?

@konstin konstin merged commit 4b19319 into main Jul 2, 2024
@konstin konstin deleted the konsti/log-retries branch July 2, 2024 17:04
zanieb added a commit that referenced this pull request May 8, 2025
Follows #13228

Closes #13338

I recall some discussion (maybe around
#4725) about how finding the source
may not work properly? I can't find it though.

Now, I tested this, e.g.:

```
❯ cargo run -q -- pip install anyio -vv --index-url https://download.pytorch.org/whl/torch/ --no-cache --reinstall
...
TRACE Considering retry of response HTTP 403 Forbidden for https://download.pytorch.org/whl/torch/anyio/
```

I lament that I didn't think of that as a testing method in the first
place :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong network Network connectivity e.g. proxies, DNS, and SSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants