Repository navigation
Conversation
Basically podman as of recently retries by default, but we can't easily replicate that behavior in the proxy - the "client" needs to handle retries. Expose the engine configuration (with retries) as an API so that projects like containers-image-proxy-rs can honor it. Assisted-by: https://github.com/cgwalters/#llms Signed-off-by: Colin Walters <[email protected]>
mtrmac
left a comment
There was a problem hiding this comment.
Thanks!
Expose the engine configuration (with retries) as an API
Hum, that doesn’t work exactly the same either, because c/common/libimage/copier has another level of defaults, setting a default for RetryDelay. I’m not sure how all these pieces are ideally expected to fit together in Podman / Buildah.
(@Luap99 PTAL at least at the config / defaults reading.)
| // A negative delay is meaningless; treat it as unset (exponential | ||
| // backoff) rather than advertising a nonsensical value to clients. |
There was a problem hiding this comment.
- AFAICS the actual behavior of
c/common/pkg/retryis to treat this as “no delay” (= wait for $delay immediately complete), not as exponential backoff - I’m aesthetically worried about silently replacing invalid data with some other data. It will not be trivial to find out how the value is “lost” if anyone had to dig into it.
Luap99
left a comment
There was a problem hiding this comment.
I am missing the larger picture here, why does the proxy need to care about containers.conf at all? Just use whatever retries you want?
So far containers.conf is used by Podman and Buildah and nothing more.
| // config.Default() memoizes internally, so this is cheap to call here. | ||
| cfg, err := config.Default() |
There was a problem hiding this comment.
I know where little about that proxy but since it is used by skopeo never depended on containers.conf in any way.
This adds a large dependency chain thus to skopeo and makes it care about something it never did before, I do not maintain skopeo so I do not have a strong opinion but it is a design choice that likely should be looked at carefully.
There was a problem hiding this comment.
Oops, yes. That’s pretty likely to be a big issue.
The status quo is documented and I understand the rationale behind it, but from the user PoV at a high level it is kind of confusing (I hope you'd agree) for bootc to read Hmm....we could add retries into |
skopeo does not read this either but does expose retry cli options. containers.conf is documented only to work with podman and buildah so I am not sure why a user would think bootc needs to use it? Practically sharing the config files has both benefits and downsides. It sounds good to have all tools use just one file but then it also means you cannot configure different defaults for different tools.
I think the possible concern there would be that retries are driven by external callers outside of the image module so we would add an option that is not used there at all. |
|
Because I want to inject a config into our CI that forces on more and longer retries for registry operations, and I want that to affect both podman and bootc.
(One can do so by e.g. injecting For a situation in which I'd want them to be different, I think we could also offer CLI flags.
Agree.
At least in the use case in which I want to bump retries, I can't think of a case where I'd want "okay the registry for caching hasn't been responding for 30 seconds, I'm going to rebuild from source instead". |
Or consider a CI job: When run nightly, users never want registry flakes, so giving it many retries 10 minutes apart is fine. When run against developers work (which they can’t test locally), it’s important for the developer to be told “the registry is unreliable now and you are not going to get this done”.
My point really is about the proper location of the configuration — at the use case top level, not as a system-wide config file. I’m sure there are deployments where the two collapse into the same thing, but that does not erase the distinction nor the argument against putting the option in global config files. [Yes, we have it in |
Pulls through skopeo have no retries at all, so a single 503 or dropped connection from e.g. quay.io fails the whole pull; this is a regular source of CI flakes for bootc. The proxy doesn't retry for us: in podman the retry loop lives in the caller (c/common pkg/retry), and podman-container-tools/container-libs#951 would only advertise podman's configured retry policy to proxy clients, which would still need to implement the retrying. So do it here. Retries happen per proxy operation (opening the image, fetching the manifest, the config, and each layer or delta blob), so a failure in one layer doesn't refetch the others, and there is a single level of retrying as suggested in the review of that PR. Backoff is exponential with jitter, defaulting to podman's 3 retries starting at 1s; PullOptions::retry tunes or disables it. Only registry (docker://) pulls retry; for local transports such as containers-storage: a failure would just repeat. Note pull_image() now retries with the default policy too. We keep using GetBlob, since it verifies the digest for us, rather than GetRawBlob, which would classify errors as retryable itself. So apart from that code, errors are classified by matching the Go error text from the proxy, modelled on c/common's IsErrorRetryable(), plus the proxy's "expected N bytes"/"corrupted blob" verdicts for truncated transfers. Only errors from the proxy are considered; a local failure to import verified data is never retried. A layer is still only registered once the proxy has verified the whole blob, and each attempt starts a fresh request. We now also wait for the proxy's verdict when the import itself failed, since a broken transfer is then usually the root cause and decides whether to retry; its error comes first in the combined message. Retries are reported as progress messages, which is how cfsctl shows them, and only logged at debug level so they don't appear twice. Assisted-by: AI Closes: composefs#348
Pulls through skopeo have no retries at all, so a single 503 or dropped connection from e.g. quay.io fails the whole pull; this is a regular source of CI flakes for bootc. The proxy doesn't retry for us: in podman the retry loop lives in the caller (c/common pkg/retry), and podman-container-tools/container-libs#951 would only advertise podman's configured retry policy to proxy clients, which would still need to implement the retrying. So do it here. Retries happen per proxy operation (opening the image, fetching the manifest, the config, and each layer or delta blob), so a failure in one layer doesn't refetch the others, and there is a single level of retrying as suggested in the review of that PR. Backoff is exponential with jitter, defaulting to podman's 3 retries starting at 1s; PullOptions::retry tunes or disables it. Only registry (docker://) pulls retry; for local transports such as containers-storage: a failure would just repeat. Note pull_image() now retries with the default policy too. We keep using GetBlob, since it verifies the digest for us, rather than GetRawBlob, which would classify errors as retryable itself. So apart from that code, errors are classified by matching the Go error text from the proxy, modelled on c/common's IsErrorRetryable(), plus the proxy's "expected N bytes"/"corrupted blob" verdicts for truncated transfers. Only errors from the proxy are considered; a local failure to import verified data is never retried. A layer is still only registered once the proxy has verified the whole blob, and each attempt starts a fresh request. We now also wait for the proxy's verdict when the import itself failed, since a broken transfer is then usually the root cause and decides whether to retry; its error comes first in the combined message. Since each attempt restarts the transfer, a layer's Started event is sent again per attempt, and cfsctl replaces that layer's progress bar. Retries are reported as progress messages, which is how cfsctl shows them, and only logged at debug level so they don't appear twice. Generated-by: AI Closes: composefs#348
Basically podman as of recently retries by default, but we can't easily replicate that behavior in the proxy - the "client" needs to handle retries.
Expose the engine configuration (with retries) as an API so that projects like containers-image-proxy-rs can honor it.
Assisted-by: https://github.com/cgwalters/#llms