-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Skyframe invalidation with disk or remote cache #22367
Comments
Can you repro with |
Are these outputs should be downloaded (e.g. toplevel outputs, or specified by If Bazel marks an action dirty to trigger a download but then doesn't download it because it shouldn't, then it's a performance issue. Otherwise, it's a correctness issue. |
I can't.
No, these outputs should not be downloaded (just hjars, jdeps files, ...), so I think this is just a performance issue. |
This is the root cause: bazel/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java Lines 328 to 337 in 43ad74b
Note the |
skymeld calls One potential solution I have discussed with @joeleba offline is to let skymeld calls |
Argh, I intended to post this link but somehow my clipboard is corrupted. |
This is a known limitation of Skymeld + BwoB. It's a tradeoff essentially: having both skymeld + bwob improves clean builds' performance, but comes with a performance penalty for incremental builds. Luckily the penalty only comes from repeating the skyframe work, since the have other layers of caches for actions. In the current state, To resolve this, we would need to do |
We reproduced this with just the remote cache. Can this have a higher than P3 priority? |
--disk_cache
Raising it to P2 but we probably won't have time to work on the fix until next month or two. In the mean while, PR is welcome! |
Friendly ping on this. |
I have a proper fix and should be able to submit it in a few days. |
Previously, we download outputs of toplevel artifacts in CompletionFunction because intermediate targets might be promoted to toplevel by skymeld in the middle of the build. However, it didn't handle runfiles of the target. This CL fixes that. A test case will be added in a followup CL because it requires changes to skymeld & BwoB to unveil the bug. Working towards #22367. PiperOrigin-RevId: 667532830 Change-Id: Idfe2a0b693f103d501c9b24a454c16186468667a
Previously, a incremental build with Skymeld and BwoB has to re-evaluate action node in order to correctly staging toplevel artifacts. The reason is BwoB requires full analysis result before execution phrase to correctly invalidate action nodes for toplevel artifacts and with Skymeld, the full analysis result is not available yet when execution phrase starts. This CL changes how BwoB invalidate action nodes before entering execution phrase: instead of depending on full analysis result, it now uses `remoteOutputChecker` from previous build -- if `lastRemoteOutputChecker` said Bazel should download one toplevel artifact but it's missing locally, we invalidate the action node. For clean build, `lastRemoteOutputChecker` is initialized to `null` because there is no action nodes to invalidate. If an artifact is promoted from intermediate output to toplevel in an incremental build, no action node is invalidated. Instead, we rely on `CompletionFunction` to download them. There is one caveat though: sometimes we need to invalidate `CompletionFunction`, e.g. when `outputsMode` is changed. Working towards #22367. PiperOrigin-RevId: 667562015 Change-Id: Ida86cf04d99fcdec998970eb3cabd63b2318246f
@bazel-io fork 7.4.0 |
…ArtifactChecker.IGNORE_ALL. Working towards #22367. PiperOrigin-RevId: 667965692 Change-Id: Ifc999a51d7ce4d5466d66c0b44e09e1491b87a6e
Previously, we download outputs of toplevel artifacts in CompletionFunction because intermediate targets might be promoted to toplevel by skymeld in the middle of the build. However, it didn't handle runfiles of the target. This CL fixes that. A test case will be added in a followup CL because it requires changes to skymeld & BwoB to unveil the bug. Working towards bazelbuild#22367. PiperOrigin-RevId: 667532830 Change-Id: Idfe2a0b693f103d501c9b24a454c16186468667a
Previously, we download outputs of toplevel artifacts in CompletionFunction because intermediate targets might be promoted to toplevel by skymeld in the middle of the build. However, it didn't handle runfiles of the target. This CL fixes that. A test case will be added in a followup CL because it requires changes to skymeld & BwoB to unveil the bug. Working towards bazelbuild#22367. PiperOrigin-RevId: 667532830 Change-Id: Idfe2a0b693f103d501c9b24a454c16186468667a
Previously, we download outputs of toplevel artifacts in CompletionFunction because intermediate targets might be promoted to toplevel by skymeld in the middle of the build. However, it didn't handle runfiles of the target. This CL fixes that. A test case will be added in a followup CL because it requires changes to skymeld & BwoB to unveil the bug. Working towards bazelbuild#22367. PiperOrigin-RevId: 667532830 Change-Id: Idfe2a0b693f103d501c9b24a454c16186468667a
Note that I have slightly modified the code to make it work with `release-7.4.0` source tree because of missing other commits. More specifically, instead of using `inputMap.getRunfilesTrees()` to get runfiles, it uses `TargetCompleteEvent`. Working towards #23434. Original Description: Previously, we download outputs of toplevel artifacts in CompletionFunction because intermediate targets might be promoted to toplevel by skymeld in the middle of the build. However, it didn't handle runfiles of the target. This CL fixes that. A test case will be added in a followup CL because it requires changes to skymeld & BwoB to unveil the bug. Working towards #22367. PiperOrigin-RevId: 667532830 Change-Id: Idfe2a0b693f103d501c9b24a454c16186468667a
Previously, a incremental build with Skymeld and BwoB has to re-evaluate action node in order to correctly staging toplevel artifacts. The reason is BwoB requires full analysis result before execution phrase to correctly invalidate action nodes for toplevel artifacts and with Skymeld, the full analysis result is not available yet when execution phrase starts. This CL changes how BwoB invalidate action nodes before entering execution phrase: instead of depending on full analysis result, it now uses `remoteOutputChecker` from previous build -- if `lastRemoteOutputChecker` said Bazel should download one toplevel artifact but it's missing locally, we invalidate the action node. For clean build, `lastRemoteOutputChecker` is initialized to `null` because there is no action nodes to invalidate. If an artifact is promoted from intermediate output to toplevel in an incremental build, no action node is invalidated. Instead, we rely on `CompletionFunction` to download them. There is one caveat though: sometimes we need to invalidate `CompletionFunction`, e.g. when `outputsMode` is changed. Working towards bazelbuild#22367. PiperOrigin-RevId: 667562015 Change-Id: Ida86cf04d99fcdec998970eb3cabd63b2318246f
Previously, a incremental build with Skymeld and BwoB has to re-evaluate action node in order to correctly staging toplevel artifacts. The reason is BwoB requires full analysis result before execution phrase to correctly invalidate action nodes for toplevel artifacts and with Skymeld, the full analysis result is not available yet when execution phrase starts. This CL changes how BwoB invalidate action nodes before entering execution phrase: instead of depending on full analysis result, it now uses `remoteOutputChecker` from previous build -- if `lastRemoteOutputChecker` said Bazel should download one toplevel artifact but it's missing locally, we invalidate the action node. For clean build, `lastRemoteOutputChecker` is initialized to `null` because there is no action nodes to invalidate. If an artifact is promoted from intermediate output to toplevel in an incremental build, no action node is invalidated. Instead, we rely on `CompletionFunction` to download them. There is one caveat though: sometimes we need to invalidate `CompletionFunction`, e.g. when `outputsMode` is changed. Working towards #22367. PiperOrigin-RevId: 667562015 Change-Id: Ida86cf04d99fcdec998970eb3cabd63b2318246f
This is fixed both in @brentleyjones Can you verify whether it improves your builds? |
Thanks! I'll have to wait for an RC to start validation. |
A fix for this issue has been included in Bazel 7.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. |
Description of the bug:
When using a disk cache (possibly also a remote cache), Bazel repeatedly marks output files obtained from the cache as dirty to trigger a download, but then doesn't download the files, so they are still missing on the next invocation.
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
baze --nosystem_rc --nohome_rc build --disk_cache=some_path //...
on some project with Java targets.See lines such as:
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?No response
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
The text was updated successfully, but these errors were encountered: