Repository navigation
Docker proxies and imports: an upstream lost mid-blob answers 503, not 500 - #869
Merged
Merged
Conversation
…t 500 Staging an upstream blob tags the body's read errors with an UpstreamBodyError inside the I/O error, as push.rs tags request bodies, and From<CasError> for Failure maps it to the upstream-unreachable failure (503, logged as a warning). An import's item names the source registry as unreachable. Staging's own I/O errors stay 500. Fixes #689 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJZDiJztZTi98zcU8Mj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJZDiJztZTi98zcU8Mj
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.
Fixes #689
What
When the upstream connection failed while Forge staged a blob (a reset, the idle
read_timeout, the download deadline), the request answered 500internal errorand the log blamed storage. It now answers like the other upstream failures.images/mod.rs: a new marker error,UpstreamBodyError, travels inside theio::Error, the same waypush.rstags request bodies withRequestBodyError.upstream_body_reader(response)wraps the upstream stream with it. Inimpl From<CasError> for Failure, aCasError::Iothat carries the marker maps toupstream_unreachable: 503the upstream registry is unreachable, logged as the warningregistry proxy: upstream request failed. Every other I/O error from staging, such as a disk error, still answers 500storage error.Registry::proxied_blob(images/proxy.rs) stages through the new reader. This covers blobs of at most 1 MiB, such as configs, and layers that come without aContent-Length.images/import.rs) stages through it too. A failed item now saysthe source registry is unreachable: reading <digest> failedinstead ofinternal error.Tests
images::tests::an_unreadable_upstream_body_is_the_upstreams_errorsits besidean_unreadable_request_body_is_the_clients_error. A real reqwest response is cut short against itsContent-Length; the test checks it maps to the unreachable 503, and that a plain I/O error still maps to 500.registry.rs::an_upstream_cut_short_mid_blob_is_unreachable.MockRegistrygets acut_blobsswitch that sends half of a small blob and then drops the connection. The pull answers 503 with the unreachable message and caches nothing. Once the upstream recovers, the pull answers 200.Run locally:
cargo fmt --all --checkpasses.cargo clippy -p forge-server --all-targets -- -D warningspasses.cargo xtask changelog --checkpasses.registry.rs.The changelog fragment is
docs/changes/2.2.0/689.fixed.md.Generated by Claude Code