-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zig package manager should retry fetching on temporary errors #17472
Comments
As noted in ziglang#17472, this should probably be configurable; however, I'm not sure what the best approach for this is, and it's not necessary for an MVP. For now, this is hardcoded to make 4 total attempts, with delays of 200, 800, and 4000 ms respectively between attempts. I've erred on the side of retrying unnecessarily here; there are definitely errors we retry on which really ought to trigger the error immediately. We can work to tighten this up a little in future. Resolves: ziglang#17472
As noted in ziglang#17472, this should probably be configurable; however, I'm not sure what the best approach for this is, and it's not necessary for an MVP. For now, this is hardcoded to make 4 total attempts, with delays of 200, 800, and 4000 ms respectively between attempts. I've erred on the side of retrying unnecessarily here; there are definitely errors we retry on which really ought to trigger the error immediately. We can work to tighten this up a little in future. Resolves: ziglang#17472
As noted in ziglang#17472, this should probably be configurable; however, I'm not sure what the best approach for this is, and it's not necessary for an MVP. For now, this is hardcoded to make 4 total attempts, with delays of 200, 800, and 4000 ms respectively between attempts. I've erred on the side of retrying unnecessarily here; there are definitely errors we retry on which really ought to trigger the error immediately. We can work to tighten this up a little in future. Resolves: ziglang#17472
Still interested in solving this issue, but wanted to suggest an alternative workaround for the time being. Could you try persisting your I think it's a nice workaround because it's something valuable to do regardless - will make your CI run faster and use less network resources. For example, mlugg's Setup Zig Action does this by default. |
We are doing this now! This plus I've mirrored all my dependency in a single web host I use has made this a non-issue for me. I think generally its still useful to solve but I have successfully worked around it. |
Zig Version
0.12.0-dev.790+ad6f8e3a5
Steps to Reproduce and Observed Behavior
My project (Ghostty) has ~20 dependencies it has to fetch from the internet given an uncached build. These are fetched from multiple sources (github, gitlab, self-hosted, etc.). Each push results in ~7 separate CI runs which run uncached. As a result, each Git push results in ~140 new HTTP fetches for these large files.
Even with this relatively small number, its big enough that I'm regularly seeing temporary errors fail CI. These are the sorts of errors that an immediate retry fixes the issue 90% of the time, and a very short backoff fixes the issue the remaining 10% of the time. So far, none of the failures have been real persisted outages.
Expected Behavior
Zig should retry on fetch errors.
The ones I've seen but this likely isn't exhaustive:
error.TemporaryNameServerFailure
temporary is even in the name!My recommendation would be to do a short series of backoffs. Even backing off a few times with a maximum total wait time of 10 seconds would probably fix 90% of my issues, but perhaps this can be configurable because for CI I'd happily configure this to upwards of a few minutes.
The backoff should probably increase, whether it be exponential, fibbonacci, whatever.
As a workaround, I can make my whole CI job retry, but the CI job does a lot of other setup and no other steps in the job are flaky so this would probably result in retrying genuine failures and cost me more money. It'd be much more convenient and faster if Zig retried.
The text was updated successfully, but these errors were encountered: