Expose the proxy's classification of retryable errors - #155
Conversation
Since protocol 0.2.8 (skopeo 1.19), every failed reply carries an error_code, which is "retryable" when containers/common's IsErrorRetryable() considers the error transient: network failures, HTTP 502-504 and registry error codes such as TOOMANYREQUESTS. That is the same heuristic podman uses to decide whether to retry a pull. We dropped it, so clients that want to retry (composefs-rs, bootc) could only match on the Go error text. Return such failures as the new RetryableRequestFailure variant, and add Error::is_retryable(), which also covers the classification GetRawBlob already reported on its error pipe. This covers FinishPipe too, so GetBlob transfers that fail part way are classified as well. Error is non_exhaustive, so the new variant is not a breaking change. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
|
That said, we should be careful to be sure this wouldn't break either of those |
|
@cgwalters Checked: neither breaks. With composefs/composefs-rs#407 does need a 0.11.1 release. Its Generated-by: https://github.com/cgwalters/#llms |
Publish Error::is_retryable() (bootc-dev#155) so that callers such as composefs-rs can retry transient registry errors without depending on a git revision. The change only adds a variant to the #[non_exhaustive] Error enum and a method, so a patch release is semver-compatible. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
Publish Error::is_retryable() (#155) so that callers such as composefs-rs can retry transient registry errors without depending on a git revision. The change only adds a variant to the #[non_exhaustive] Error enum and a method, so a patch release is semver-compatible. Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
Since protocol 0.2.8 (skopeo 1.19), the proxy sets
error_code: "retryable"on failed replies when containers/common'sIsErrorRetryable()considers the error transient: network errors, HTTP 502-504, and registry error codes like TOOMANYREQUESTS. That's the same check podman uses to decide whether to retry a pull. We've been dropping that field, so a client that wants to retry can only match on the Go error text. composefs-rs wants to retry pulls (composefs/composefs-rs#348), and bootc would benefit too.This adds
Error::is_retryable(), backed by a newRetryableRequestFailurevariant. It also covers theGetRawBloberror-pipe classification that was already there, andFinishPipereplies, so aGetBlobtransfer that fails part way gets classified too.Erroris#[non_exhaustive], so adding the variant isn't a semver break. With older proxies that don't send an error code, nothing is retryable, and behavior stays as before.One behavior change for callers: code that matches
RequestInitiationFailureto catch every failed reply will now miss the transient ones, which arrive asRetryableRequestFailure. That should go in the release notes. This is the typed error that the TODO in bootc'sis_retryable_pull_error()(crates/lib/src/deploy.rs) asks for (bootc-dev/bootc#2466). Once this is released, bootc can callError::is_retryable()there and also retryOpenImagefailures.Plan: land this and release it as 0.11.1. composefs-rs then replaces its temporary git
[patch]with a version bump (cgwalters-forge/composefs-rs#1).Tested on a 16-core devspace (RHEL 10, skopeo 1.22.2):
cargo fmt --check,cargo test --all-features(includes a new test against real skopeo: connection refused ondocker://is retryable, a missingoci:dir isn't), andcargo clippywith no new warnings. The same tests also ran inquay.io/almalinuxorg/almalinux-bootc:10.0(skopeo 1.18, where the skopeo test is skipped).cargo semver-checks(in Fedora, rustc 1.98) reports no semver update required.Related: composefs/composefs-rs#348
The
Signed-off-by: Colin Walters <walters@verbum.org>on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#2 (review)Generated-by: https://github.com/cgwalters/#llms