Skip to content

solver: handle not found error on cache export #5999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

tonistiigi
Copy link
Member

fixes #5784 (hopefully)
possible that this appears more frequently after #5692

When a cleanup happens while a build is running it may cause boltdb record to be deleted while that record would have been used for cache export of the running build, causing the cache export to fail with Not Found error. This is possible because when the cache is loaded to snapshots, then snapshots are reference counted, protecting against them being released or deleted, but when the cache key is just an intermediary, the query result just gets saved and is used later.

It should be safe to ignore this error and skip over the result if it doesn't exist anymore.

Note that cache export also gets called on provenance creation because cache chains are used for finding remote descriptors for build steps. This was the more likely codepath for hitting this error.

When a cleanup happens while a build is running it
may cause boltdb record to be deleted while that record
would have been used for cache export of the running build,
causing the cache export to fail with Not Found error. This
is possible because when cache is loaded to snapshots then
snapshots are reference counted, protecting against them being
released or deleted, but when cache key is just intermediary,
the query result just gets saved and is used later.

It should be safe to ignore this error and skip over the result
if it doesn't exist anymore.

Note that cache export also gets called on provenance
creation because cache chains are used for finding remote
descriptors for build steps. This was the more likely
codepath for hitting this error.

Signed-off-by: Tonis Tiigi <[email protected]>
@tonistiigi tonistiigi force-pushed the cache-export-notfound branch from a252c4e to 705a9bc Compare May 29, 2025 04:31
@tonistiigi tonistiigi marked this pull request as ready for review May 29, 2025 17:32
@AkihiroSuda AkihiroSuda merged commit 141fe1b into moby:master Jun 5, 2025
168 of 169 checks passed
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.

Build cache ERROR: failed to solve: Internal: not found
2 participants