Repository navigation
fix: dedupe uncached metadata across a session - #6505
Conversation
Signed-off-by: Justin Chadwell <[email protected]>
f26cf24 to
8f78058
Compare
vito
left a comment
There was a problem hiding this comment.
Seems reasonable to me considering this is effectively what happened before, just on the other side of the fence. Definitely a bit weird, but now it's explicitly weird, so maybe we can figure it out someday.
sipsma
left a comment
There was a problem hiding this comment.
LGTM, nice idea on the approach to fixing this!
I'm wondering if there's any chance this could somehow be related to #6493 ? Just in that it seems like previously we'd always overwrite ParentClientIDs, which impacts search domains of containers with service deps. This is a completely superficial guess, haven't looked into details at all, may be completely unrelated. cc @vito
|
Also, agreed on the weirdness here, but that's a pre-existing issue, so all good. The solution is to move on from the ftp proxy hack, but that's a whole other can of worms. |
Turns out this is still needed by legacy dagger (dagger run, go run + auto-started session, etc). It's unfortunate to bring all this plumbing back but we obviously can't break all that yet. Kept everything as-is, including propagating parents, because dagger#6505 prevents the cache-busting issue that we originally ripped all this out to avoid. This reverts commit 3309a8e. Signed-off-by: Alex Suraci <[email protected]>
Turns out this is still needed by legacy dagger (dagger run, go run + auto-started session, etc). It's unfortunate to bring all this plumbing back but we obviously can't break all that yet. Kept everything as-is, including propagating parents, because #6505 prevents the cache-busting issue that we originally ripped all this out to avoid. This reverts commit 3309a8e. Signed-off-by: Alex Suraci <[email protected]>
Fixes #6501.
Thank goodness it's Friday, lol.
The root cause of #6501 is that every single ExecOp gets a unique digest. This means that the buildkit solver is not able to dedupe them, and instead, to ensure it only runs once, we rely on the edge merging behavior. This was kiiiinda hacky, and not super great - edge merging is supposed to be for different vertexes that happen to produce similar output (detected by their cache keys). We were using it for pretty much everything.
Since moby/buildkit@e1da8b7 (introduced in #6481), the progress behavior changes - edge merges now duplicate the progress. This makes sense! Because edge merges are for "coincidentally" similar edges, the progress should occur for both.
The trick here is to stop relying on this edge merging behavior, by making more ExecOps have a similar digest. The cause of the different digests is the server ids and the parent client ids, so we make an explicit effort to not modify these these for ExecOps that were previously the same, by using a map to cache previous metadata. Because the cache map is on the
Client, then this effectively dedupes across only the session - different sessions don't get deduped with each other, which is fine, because they would have different server ids anyways! (and in this case, we actually want the edge merge to happen, so we get progress to both! see moby/buildkit#4330)Note
This does seem like a bizarre trick to pull. Is it actually safe to dedupe these like this?
However, we were doing it similar via edge-merges, this just forces the merge to happen at the buildkit solver level, which is much much easier.