Skip to content
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

[release/1.7] Fix HTTPFallback fails when pushing manifest #10044

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

ktock
Copy link
Member

@ktock ktock commented Apr 8, 2024

Backporting #10031

Description from #10031

The pusher supports fallback from HTTPS to HTTP using HTTPFallback. But the current implementation of HTTPFallback doesn't reset the request body on fallback so the body is used twice. When the pusher uploads the manifest using HTTPFallback, it results in io: read/write on closed pipe error because the request body is a *io.PipeReader that can't be used twice. This commit fixes this issue by modifying HTTPFallback to reset the request body on fallback, using http.Request.GetBody().

Reusing the request body didn't happen when uploading the layer because the pusher correctly selects the scheme based on Location header and avoids fallback. This commit also fixes the test to cover the code path of uploading the manifest with fallback.

Additional information

  • The same error is observed also in v1.7.14 so I'll backport this patch to that branch after this is merged to the main branch.
  • The error starts to happen after 2a25c08 according to bisect. *io.PipeReader is closed before fallback so reusing it results in the explicit error.
  • This will also fix that ctr + --plain-http failed with io: read/write on closed pipe error (>= v1.7.14)

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@ktock
Copy link
Member Author

ktock commented Apr 8, 2024

/retest

@mxpv mxpv merged commit 3d3287d into containerd:release/1.7 Apr 8, 2024
56 checks passed
@ktock ktock deleted the fail-plain-http-1.7 branch April 9, 2024 00:46
@dmcgowan dmcgowan changed the title [release/1.7] remote: Fix HTTPFallback fails when pushing manifest [release/1.7] Fix HTTPFallback fails when pushing manifest Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants