Skip to content

fix(storage): abort garbage collection on manifest lookup errors - #5083

Open
perfloop-agent wants to merge 1 commit into
distribution:mainfrom
perfloop-oss:perfloop-pr-open-n2n2v2jrqs
Open

perfloop-agent wants to merge 1 commit into
distribution:mainfrom
perfloop-oss:perfloop-pr-open-n2n2v2jrqs

Conversation

@perfloop-agent

Copy link
Copy Markdown
Contributor

--delete-untagged can remove the configuration of an image retained by a tagged index when a manifest-existence lookup fails. Recursive traversal added in #4285 marks the child digest before that lookup, so retaining the child manifest does not protect its unvisited descendants.

markManifestReferences now returns a contextual marking error instead of discarding an error from ManifestService.Exists. MarkAndSweep then stops before sweep. A definite missing reference (false, nil) still skips recursion, and successful lookups follow the existing traversal.

The regression test in registry/storage/garbagecollect_test.go uses a tagged OCI index, an untagged image and a transient child-data Stat failure. It checks the returned error, absence of Delete calls and byte-for-byte preservation of the stored blobs.

The Go garbage-collection tests passed, covering healthy traversal, dangling references, dry runs and deletion behavior alongside the new failure case.

Fault coverage uses an in-memory store with no concurrent writes; failure frequency on real backends remains unknown.

Related work: #4884 and #4795 change GC traversal and scheduling but leave this error boundary unchanged.

This change was developed with AI assistance.

Case and evidence


Made by Perfloop. Human sponsor: Tomás Senart.

@perfloop
perfloop Bot force-pushed the perfloop-pr-open-n2n2v2jrqs branch from b809532 to de0837a Compare November 12, 2026 22:24
@milosgajdos

Copy link
Copy Markdown
Member

Closing and reopening because GH CI is stuck so hoping that'll rekick it

@milosgajdos milosgajdos reopened this Nov 13, 2026
@milosgajdos

milosgajdos commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

@perfloop-agent squash your commits

@perfloop-agent

Copy link
Copy Markdown
Contributor Author

Squashed into one commit (66a724f).

A failed existence lookup can leave the descendants of a tagged index unmarked. With delete-untagged enabled, sweeping that incomplete set can remove the retained image configuration.

Return a contextual marking error instead of treating a failed lookup as a missing reference. Known missing references still return false without an error and keep their existing handling.

Add a regression test: a tagged index retains an untagged image and its configuration; a transient error in the child manifest existence lookup must abort marking before any deletion, leaving the original blobs readable.

Signed-off-by: Perfloop Agent <[email protected]>
@perfloop
perfloop Bot force-pushed the perfloop-pr-open-n2n2v2jrqs branch from 66a724f to e564989 Compare December 2, 2026 04:26

This branch has not been deployed

No deployments
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.

2 participants