You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, so after narrowing down the issue. I think that the deduplication issue is fixed. In a sense that this is not the case anymore when building such definition.
Below, I dagger query the last action in my pipeline.
It only shows this cue subtree, no other part of the DAG has been copied inside.
However, this error is still present: It seems to come from the engine.#Push instruction, which seems to rerun all always: true steps in the constructed fs.
This is because always: true is backed by llb.IgnoreCache(), which only works through a single Build() session (dagger.#Push uses its separate Build() session).
llb.IgnoreCache() is also breaking #CacheDir when using --no-cache: #1357
One solution would be to revert #331 (/cc @samalba) and go back to the DAGGER_CACHEBUSTER method. I think since we're not embedding CUE anymore, this will work.
foo.#up[0] would inject DAGGER_CACHEBUSTER with value YYY
bar.#up[0].mount["/foo"].#up[0] would appear as a new "task", and inject DAGGER_CACHEBUSTER with value ZZZ
Therefore the always: true would run twice.
AFAIK, with Europa and the lack of embedding, this problem won't happen anymore (e.g. we'd mount the foo.outputdagger.#FS into bar, and therefore won't be duplicating the task)
This is because always: true is backed by llb.IgnoreCache(), which only works through a single Build() session (dagger.#Push uses its separate Build() session).
llb.IgnoreCache() is also breaking #CacheDir when using --no-cache: #1357
One solution would be to revert #331 (/cc @samalba) and go back to the DAGGER_CACHEBUSTER method. I think since we're not embedding CUE anymore, this will work.
foo.#up[0] would inject DAGGER_CACHEBUSTER with value YYY
bar.#up[0].mount["/foo"].#up[0] would appear as a new "task", and inject DAGGER_CACHEBUSTER with value ZZZ
Therefore the always: true would run twice.
AFAIK, with Europa and the lack of embedding, this problem won't happen anymore (e.g. we'd mount the foo.outputdagger.#FS into bar, and therefore won't be duplicating the task)
Next steps
With @TomChv's advice. I will try to separate the main build logs from the sub build [== dagger.#Push] logs.
Guessed root cause: we s.opts.Control.Build with a new session. Buildkit triggers the cache, but with another session and print the corresponding cached output without re-executing. Weird, but highly probable.
I don't know wether a repro in pure buildkit is an obligation atm. wdyt ?
There is still < 0.5% of chance that the new session actually runs the print and the duplicate in parallel because echoed commands are not logged as CACHED but DONE.
I highly doubt it is currently the case, as I ran hundreds of tests and the timing was always similar between first run and followings
I confirm once again that this is just a log issue. It works as expected, apart from that reprinting.
I don't know the root cause yet (wether it's related to us or to buildkit, currently implenting a more in-depth repro case). At least, it's a contained issue @aluzzardi, and Europa did solve the previous related ones.
I renamed the issue to reflect your latest findings @grouville . Does this duplicate logging occur for any core actions, or only a subset?
Also: perhaps we should close this and create a new issue for the narrower scope you understood. There is a lot of discussion from last year in this issue, that is obsolete.
Took a look and believe I figured out what was going on. I think this is actually intentional behavior on Buildkit's part.
We open a separate session in order to Export results (as a workaround for the lack of Export in the Gateway API), but as far as Buildkit knows that's the same as a totally separate client connecting and requesting a build that happens to overlap with an existing on-going build. Buildkit thus tries to be helpful and "backfill" the new client on all the progress so far. That's nice of it but in this case we are actually the same client, so we just end up with a bunch of duplicate progress events.
I opened an issue w/ Buildkit that has some more details and proposed fixes here. For now, I think the solution of tracking which vertex digests have been completed and skipping logs for those ones is probably the best bet. It's more complicated for us and less performant than the other options, but has the large advantage of not needing upstream changes (and thus waiting for a new Buildkit release).
Activity
aluzzardi commentedon Jun 7, 2021
Possibly (hopefully) a duplicate of #495
Assigning to @samalba for triaging
samalba commentedon Jun 22, 2021
I confirm this is still open
13 remaining items
grouville commentedon Feb 4, 2022
Ok, so after narrowing down the issue. I think that the deduplication issue is fixed. In a sense that this is not the case anymore when building such definition.
Below, I
dagger querythe last action in my pipeline.It only shows this cue subtree, no other part of the DAG has been copied inside.
However, this error is still present: It seems to come from the
engine.#Pushinstruction, which seems to rerun allalways: truesteps in the constructedfs.Here is the gist repo case: https://gist.github.com/grouville/cd313727e6a5a581206af4b2d7ef932b
aluzzardi commentedon Feb 24, 2022
This is because
always: trueis backed byllb.IgnoreCache(), which only works through a singleBuild()session (dagger.#Pushuses its separateBuild()session).llb.IgnoreCache()is also breaking#CacheDirwhen using--no-cache: #1357One solution would be to revert #331 (/cc @samalba) and go back to the
DAGGER_CACHEBUSTERmethod. I think since we're not embedding CUE anymore, this will work.The problem we had before was this:
foo.#up[0]would injectDAGGER_CACHEBUSTERwith valueYYYbar.#up[0].mount["/foo"].#up[0]would appear as a new "task", and injectDAGGER_CACHEBUSTERwith valueZZZTherefore the
always: truewould run twice.AFAIK, with Europa and the lack of embedding, this problem won't happen anymore (e.g. we'd mount the
foo.outputdagger.#FSintobar, and therefore won't be duplicating the task)/cc @shykes
grouville commentedon Mar 2, 2022
It doesn't seem to work 😢 Here is my repro: https://gist.github.com/grouville/3cea54be3551aa99a229d9fbeed24527
Test branch: https://github.com/grouville/dagger/tree/always-true
grouville commentedon Mar 4, 2022
@aluzzardi, I tested with
llb.ignoreCache. Exactly the same behavior as withDAGGER_CACHEBUSTERmethod: https://gist.github.com/grouville/f86244771969f3428a077b7a9eff562dNext steps
With @TomChv's advice. I will try to separate the
main buildlogs from thesub build[== dagger.#Push] logs.Guessed root cause: we
s.opts.Control.Buildwith a new session. Buildkit triggers the cache, but with another session and print the corresponding cached output without re-executing. Weird, but highly probable.I don't know wether a repro in pure buildkit is an obligation atm. wdyt ?
There is still < 0.5% of chance that the new session actually runs the print and the duplicate in parallel because
echoedcommands are not logged asCACHEDbutDONE.I highly doubt it is currently the case, as I ran hundreds of tests and the timing was always similar between first run and followings
grouville commentedon Mar 7, 2022
I confirm once again that this is just a log issue. It works as expected, apart from that reprinting.
I don't know the root cause yet (wether it's related to us or to buildkit, currently implenting a more in-depth repro case). At least, it's a contained issue @aluzzardi, and Europa did solve the previous related ones.
Repro: https://gist.github.com/grouville/a9133208c9851932a4c2e1d6de72a748
Basically, we see that the random waits are the same, even in the
dagger.#Pushstep (which is a new Build). If I was being re-executed, it would be a different one + the sleep time are coherent with the expected behavior[-]DockerBuild runs many times when it should run once[/-][+]Duplicate log messages[/+]shykes commentedon Apr 8, 2022
I renamed the issue to reflect your latest findings @grouville . Does this duplicate logging occur for any core actions, or only a subset?
Also: perhaps we should close this and create a new issue for the narrower scope you understood. There is a lot of discussion from last year in this issue, that is obsolete.
sipsma commentedon Apr 20, 2022
Took a look and believe I figured out what was going on. I think this is actually intentional behavior on Buildkit's part.
We open a separate session in order to Export results (as a workaround for the lack of
Exportin the Gateway API), but as far as Buildkit knows that's the same as a totally separate client connecting and requesting a build that happens to overlap with an existing on-going build. Buildkit thus tries to be helpful and "backfill" the new client on all the progress so far. That's nice of it but in this case we are actually the same client, so we just end up with a bunch of duplicate progress events.I opened an issue w/ Buildkit that has some more details and proposed fixes here. For now, I think the solution of tracking which vertex digests have been completed and skipping logs for those ones is probably the best bet. It's more complicated for us and less performant than the other options, but has the large advantage of not needing upstream changes (and thus waiting for a new Buildkit release).