From 2d733db04dc107ccb47f041caa10e861b1d248ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20L=C3=B3pez=20Luna?= Date: Mon, 16 Feb 2026 09:00:39 +0100 Subject: [PATCH] fix: acquire read lock for r.blobs access in test registry POST handler The race detector flagged an unprotected read of r.blobs via len() in the POST handler while concurrent PUT/PATCH handlers write to the map under r.mu.Lock(). Wrap with RLock/RUnlock to match every other access. Co-Authored-By: Claude Opus 4.6 --- pkg/distribution/registry/testregistry/registry.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/distribution/registry/testregistry/registry.go b/pkg/distribution/registry/testregistry/registry.go index b8555266b..e82aa233e 100644 --- a/pkg/distribution/registry/testregistry/registry.go +++ b/pkg/distribution/registry/testregistry/registry.go @@ -69,7 +69,9 @@ func (r *Registry) handleBlobUpload(w http.ResponseWriter, req *http.Request, pa switch req.Method { case http.MethodPost: // Start upload + r.mu.RLock() uploadID := fmt.Sprintf("upload-%d", len(r.blobs)) + r.mu.RUnlock() location := fmt.Sprintf("/v2/%s/blobs/uploads/%s", repo, uploadID) w.Header().Set("Location", location) w.Header().Set("Docker-Upload-UUID", uploadID)