[release/1.7] Fix HTTPFallback fails when pushing manifest#10044
Merged
mxpv merged 1 commit intocontainerd:release/1.7from Apr 8, 2024
Merged
[release/1.7] Fix HTTPFallback fails when pushing manifest#10044mxpv merged 1 commit intocontainerd:release/1.7from
mxpv merged 1 commit intocontainerd:release/1.7from
Conversation
Signed-off-by: Kohei Tokunaga <[email protected]>
Member
Author
|
/retest |
estesp
approved these changes
Apr 8, 2024
mxpv
approved these changes
Apr 8, 2024
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.
Backporting #10031
Description from #10031
The pusher supports fallback from HTTPS to HTTP using
HTTPFallback. But the current implementation ofHTTPFallbackdoesn't reset the request body on fallback so the body is used twice. When the pusher uploads the manifest usingHTTPFallback, it results inio: read/write on closed pipeerror because the request body is a*io.PipeReaderthat can't be used twice. This commit fixes this issue by modifyingHTTPFallbackto reset the request body on fallback, usinghttp.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
*io.PipeReaderis closed before fallback so reusing it results in the explicit error.ctr+--plain-httpfailed withio: read/write on closed pipeerror (>= v1.7.14)failed to copy: failed to do request: Put "https://registry-alt.test:5000/v2/alpine/manifests/sha256:01344c7e6bf6a4b063eee2c3c83f39ef515e6dea8af546a7a1fc786f3d1a82c0": readfrom tcp 172.18.0.2:40046->172.18.0.4:5000: io: read/write on closed pipe