Repository navigation
engine: retry image pulls and resolves after a network error - #14978
Merged
Merged
Conversation
sipsma
force-pushed
the
sipsma/registry-pull-retry
branch
4 times, most recently
from
November 4, 2026 21:09
8c9d803 to
eb99d0a
Compare
tiborvass
approved these changes
Nov 6, 2026
sipsma
force-pushed
the
sipsma/registry-pull-retry
branch
from
November 6, 2026 20:07
eb99d0a to
8b16048
Compare
Pulling an image fetched each blob once. When the registry reset the connection partway through a layer, the pull failed with "failed to copy: ... connection reset by peer"; containerd's reader only reconnects after an unexpected EOF. mcr.microsoft.com does this now and then, which fails TestPlatform/TestWindows. The pull path that #11856 replaced wrapped this handler in BuildKit's retry handler, which retries resets, EOFs, temporary network errors and 5xx responses with backoff. Wrap the new one the same way. Signed-off-by: Erik Sipsma <[email protected]>
Resolving an image sent its manifest request once. When the TLS handshake with the registry timed out, Container.from failed with "failed to do request: Head ...: net/http: TLS handshake timeout". containerd retries a manifest request after some error statuses, but not after a network error. mcr.microsoft.com does this now and then, which fails TestPlatform/TestWindows. Retry the resolve with the same retry handler as a blob fetch: network errors, resets, EOFs and 5xx responses are retried with backoff, while a missing image or a refused login still fails at once. This covers resolving an image's config, its digest, and pulling it. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
staticcheck's ST1016 wants every method of a type to use the same receiver name. The test registry's handler names it registry, since r is its request, so manifestRequests does too. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/registry-pull-retry
branch
2 times, most recently
from
November 10, 2026 01:01
e531358 to
91a4556
Compare
sipsma
added a commit
that referenced
this pull request
Nov 17, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 17, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 20, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 20, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 21, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 21, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 25, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
added a commit
that referenced
this pull request
Nov 25, 2026
…error #14978 retried resolving an image's root and fetching its layers after a network error, but resolving then reads the platform manifest and the image config from the registry without a retry. On mcr.microsoft.com a reset on the config blob still failed TestWindows: "failed to copy: httpReadSeeker: failed open: ... write: connection reset by peer". Retry those reads as a pull's blob fetches are: the metadata fetch every resolve and pull runs first, and the reads a force pull makes straight from the registry. Signed-off-by: Erik Sipsma <[email protected]>
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.
Since #11856 moved image pulls onto the new resolver, a pull makes each registry request once. A network error partway through now fails the whole
Container.from, where the old pull path retried. This affects anyone pulling from a registry that occasionally drops connections. In our CI it is behind every recentTestPlatform/TestWindowsfailure: mcr.microsoft.com resets connections now and then.This PR retries both requests that can hit this, with BuildKit's existing retry handler, the one the pre-#11856 pull path used. It retries connection resets, EOFs, temporary network errors and 5xx responses, up to 4 attempts, waiting 1, 2 and 4 s.
Resolver.Pull): a reset partway through a layer failed withfailed to copy: ... connection reset by peer. containerd's reader only reconnects after an unexpected EOF. A retried download resumes where it stopped. Three of the four recentTestWindowsfailures were this.resolveRemoteRootDescriptor, which resolving an image's config, resolving its digest and pulling all go through): containerd retries some error statuses (401, 408, 429, a 5xx), but no network errors. The fourth failure wasfailed to do request: Head ".../manifests/ltsc2022": net/http: TLS handshake timeout.A missing image, a refused login and other 4xx answers still fail at once. Pulls that succeed take the same path as before. A pull that keeps hitting network errors now takes up to about 7 s longer to fail.
Tests, in
engine/server/resolver/pull_metadata_test.go, run by CI'stest-split/test-packages:TLS handshake timeouterror.