Repository navigation
remotes: revert closing fetch readers at EOF - #14194
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The reader lifecycle change may regress non-seekable readers and CRI progress accounting.
Pull request overview
Fixes registry upload retries after EOF by preserving readers until content.Copy completes while retaining HTTP EOF cleanup.
Changes:
- Removes generic close-on-EOF wrappers.
- Adds upload retry regression coverage.
- Tests HTTP body lifecycle and seekability.
File summaries
| File | Summary |
|---|---|
core/remotes/handlers.go |
Defers reader closure; requires preserving EOF-close behavior for non-seekable readers. |
core/remotes/docker/pusher_test.go |
Tests upload recovery after retryable responses. |
core/remotes/docker/fetcher_test.go |
Tests HTTP EOF closure and commit timing. |
Review details
Suppressed comments (1)
core/remotes/handlers.go:181
- This changes the generic
Fetchercontract for every non-HTTP/non-seekable reader:Closeis now deferred untilcontent.Copyreturns, so a reader that reaches EOF can keep its underlying request/resource active whileCommitblocks. The removed wrapper closed such readers at EOF (and the CRI progress accounting relies on that lifecycle). Preserve the EOF-close behavior for non-seekable readers, while leaving seekable readers usable for reset retries, or otherwise document and update all Fetcher implementations to provide equivalent semantics.
// Keep the reader usable until Copy finishes: a writer may request a
// reset after EOF, including while committing the content.
defer rc.Close()
return content.Copy(ctx, cw, rc, desc.Size, desc.Digest)
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/cherry-pick release/2.4 |
|
@thaJeztah: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| require.NoError(t, err) | ||
| defer rc.Close() | ||
|
|
||
| for i := 0; i < 2; i++ { |
There was a problem hiding this comment.
In case linters start to complain;
for i := range 2 {|
Would you prefer this or to revert #13438 entirely? Based on #13438 (comment), the change in #13304 might have been sufficient to prevent the test flake anyway. |
|
Okay, looking at the diff this does revert #13438. Can you change the commit structure slightly:
|
This reverts commit a989093. Signed-off-by: CrazyMax <[email protected]>
Verify that small and large layer uploads can be replayed after the registry consumes the body and returns HTTP 408. This covers the fetch-to-pusher path used by BuildKit registry cache exports. Check that HTTP readers close their response bodies at EOF while remaining seekable, and that the body is closed exactly once before the destination writer commits. Signed-off-by: CrazyMax <[email protected]>
d320648 to
0bdad46
Compare
|
@thaJeztah: new pull request created: #14197 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Revert #13438 to restore registry-cache upload retries, addressing the regression blocking BuildKit containerd v2.4.0 upgrade in moby/buildkit#7173 (comment). Closing the source reader at EOF prevents
content.Copyfrom rewinding it when the destination writer requests a retry, causing uploads to fail withseek on closed reader.The HTTP reader already closes its response body at EOF while remaining seekable, preserving CRI progress accounting before a slow commit without the generic wrapper. A separate commit adds regression tests for replaying uploads after HTTP 408, seeking after EOF, and closing the HTTP body exactly once before commit.