#23600·harbor

Proxy cache: no retry on interrupted upstream blob fetch, and no digest verification before caching

Author: oscrxCreated Jul 22, 2026Updated Sep 28, 2026

Expected behavior and actual behavior:

Expected: when Harbor's proxy cache is pulling a blob (layer) from an upstream registry and the upstream connection is interrupted mid-transfer (dropped/reset by an intermediate network device), Harbor should retry the fetch — comparable to how a plain docker/OCI client retries an interrupted layer pull — and should never cache or serve a blob whose content doesn't match its declared digest.

Actual: the proxy cache's upstream blob fetch is a single-shot HTTP GET with no retry logic anywhere in the code path, and no digest verification of the fetched bytes before they're pushed to local cache storage. Concretely:

  • ProxyBlob / putBlobToLocal in src/controller/proxy/controller.go each call RemoteInterface.BlobReader() exactly once. On a mid-stream read error (e.g. unexpected EOF from a reset connection), the client-serving fetch just returns the error, and the background cache-populate fetch logs "error while putting blob to local repo, %v" and gives up — no retry, no resume from the last byte offset.
  • ManifestCache.putBlobToLocal in src/controller/proxy/manifestcache.go has the identical single-shot, no-retry pattern, used when caching a manifest list's dependent blobs.
  • Neither path recomputes/verifies the digest of the bytes actually received against the expected blob digest before treating a cache-populate push as successful — verification is implicitly delegated to whatever the local registry storage engine happens to do at commit time, not performed by Harbor itself.

In our deployment, images are pulled through Harbor's proxy cache in front of an upstream registry, with a corporate TLS-inspecting web proxy sitting between Harbor and the upstream (CRI-O → Harbor proxy cache → corporate web proxy → upstream registry). That web proxy has a non-trivial false-positive rate on its inspection rules and, when triggered on a specific blob, kills the TCP session mid-transfer. Because Harbor doesn't retry, this either fails the cache-populate fetch outright (visible in logs) or — depending on exactly where in the stream the reset lands relative to header/body framing — can result in an incomplete/corrupted blob reaching the cache-populate path with nothing catching the mismatch before it's pushed. Our current workaround is pulling the same image with the plain docker CLI through the same corporate proxy instead of through Harbor, since the docker/containerd client-side pull logic retries the dropped connection and the proxy doesn't re-trigger on the retry — this strongly suggests the fix belongs on Harbor's proxy-cache fetch path, not the network layer.

Steps to reproduce the problem:

  1. Configure a Harbor proxy-cache project pointing at an upstream registry that is reachable only through a network path capable of resetting a TCP connection mid-transfer (a corporate TLS-inspecting proxy, a flaky link, or any MITM/inspection proxy that can be induced to drop a session mid-stream).
  2. Pull a multi-layer image through the proxy-cache project (docker pull <harbor-host>/<proxy-project>/<image>:<tag>), ideally one with at least one large layer, so there's a realistic window for a mid-transfer interruption.
  3. Trigger (or wait for) the intermediate network path to reset the connection while Harbor is mid-fetch of one of the blobs from upstream.
  4. Observe harbor-core logs for the proxy-cache background push, e.g.:
    error while putting blob to local repo, <error containing "unexpected EOF" or a similar mid-stream read error>
    at src/controller/proxy/controller.go's putBlobToLocal (or the equivalent path in manifestcache.go if the interrupted blob is a manifest-list dependency).
  5. Note that nothing retries this fetch — the layer either fails to get cached (subsequent pulls repeat the same failure-prone fetch against the same flaky network path) or, if the interruption manifests as a length-preserving corruption rather than a hard read error, nothing in Harbor's own code checks the resulting bytes against the blob's digest before caching.

Versions: Please specify the versions of following systems.

  • harbor version: v2.15.2
  • docker engine version: not applicable — this is a proxy-cache upstream-fetch code path, reproducible independent of the pulling client's docker engine version
  • docker-compose version: not applicable

Additional context:

  • Relevant code: src/controller/proxy/controller.go (ProxyBlob, putBlobToLocal) and src/controller/proxy/manifestcache.go (ManifestCache.putBlobToLocal) — both call RemoteInterface.BlobReader() a single time with no retry/backoff, and neither verifies the fetched content's digest before treating the fetch as complete/cacheable.
  • This looks related to, but distinct from, a few existing reports, which I think are worth cross-referencing rather than treating as duplicates:
    • #20831 ("Image Digest Mismatch Issue") — the reporter's logs show exactly this code path failing (error while putting blob to local repo at controller.go, with the underlying registry logging client disconnected during blob PUT ... unexpected EOF) on a large blob push to local cache. The response there addressed a narrower, separate digest-mismatch cause, not the underlying lack of retry.
    • #22393 ("Harbor image pull fails for large images (~40GB) after ~30 minutes despite timeout config changes") — root-caused to the registry HTTP client's overall request timeout (REGISTRY_HTTP_CLIENT_TIMEOUT, default 30 min) firing, which is a timeout, not a retry mechanism; closed as not planned. Same underlying gap (no retry on a failed upstream fetch), different trigger (timeout vs. connection reset).
    • #22555 ("Large image filesystem layer verification failed for digest") — first-time pulls of large images through proxy cache fail with a layer verification error; retrying the pull once the blob is cached elsewhere works. Consistent with a fetch-race/no-retry gap rather than a digest-verification bug per se.
    • #14822 ("Proxy cache does not provide images when target registry is not working") — related reliability gap in the same area: the proxy cache has no resilience story for upstream connectivity problems in general, whether that's a hard outage (#14822) or a mid-transfer interruption (this issue).
  • I have a fix ready and am opening a PR for it immediately alongside this issue: a bounded-retry reader that resumes an interrupted upstream fetch from the last successfully-read byte offset via an HTTP range request (PullBlobChunk, which already exists on the registry adapter but wasn't wired into the proxy-cache fetch path), plus a digest-verifying reader that rejects a cache-populate push whose content doesn't match the expected digest instead of silently committing it.