Skip to content
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

Fix various lazy blob errors involving dedupe by chainID #5560

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sipsma
Copy link
Collaborator

@sipsma sipsma commented Dec 2, 2024

Hit a few errors in various places that involve lazy blobs which are deduped by chainID with other refs. This creates a corner case in that they are considered lazy (since blobs were never pulled) but have a snapshot ID. The cache export code and cache mount code needed some fixes to handle this in all cases.

Individual commit messages have more context.

There were two lines that checked if err != nil and return nil error.
This seems likely to be a typo, especially since there is support for
ignoring errors during cache export but on a completely different level
of abstraction (in llbsolver).

There were bugs causing errors during cache export (fixed in subsequent
commits) which ended up getting silently dropped and causing cache
exports to be missing mysteriously. Now errors are returned and only
ignored if cache export errors are configured to be ignored.

Signed-off-by: Erik Sipsma <[email protected]>
Before this change, lazy blobs were handled during cache export by
providing descHandlers from the ref being exported in llbsolver.

However, this didn't handle some max cache export cases that involve use
of read-write mounts. Specifically, if you exported cache for a ref from
a read-write mount in an ExecOp, the ref's descHandlers didn't include
handlers for any refs from the the rootfs of the ExecOp.

If any of those refs for the rootfs involved lazy blobs, any error would
get hit during cache export about lazy blobs. It's possible for the
rootfs to have lazy blobs in a few different ways, but the one tested in
the integ test added here involves two images with layers that get
deduped by chainID (i.e. uncompress to the same layer but have different
compressions). Image layer refs that find an existing ref w/ same
chainID will get a snapshot for free but stay lazy in terms of their
blobs, thus making it possible for an exec to run on top of them while
still considered lazy.

The fix here puts the CacheOptGetter logic in the cache export code
directly so that it can use the solver's information on dependencies to
find all possible descHandlers, including those for the rootfs in the
read-write mount case.

Signed-off-by: Erik Sipsma <[email protected]>
Before this change, if a cache mount had base layers from a ref and
those layers were lazy, you could hit missing blob errors when trying to
reload an existing mutable ref for the cache mount.

It's possible to have lazy refs in the base layers when blobs get
deduped by chainID.

The fix is just to handle the lazy blob error and reload with
descHandlers set.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
Copy link
Collaborator Author

sipsma commented Dec 2, 2024

Hm seems like b3e72fa revealed other pre-existing tests hitting errors during cache export that still aren't fixed. Will take a look but would appreciate any feedback in the meantime.

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.

1 participant