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
{{ message }}
Repository navigation
Allow sharing caches across actions when sandboxing is in use #7527
P2We'll consider working on this in future. (Assignee optional)not staleIssues or PRs that are inactive but not considered staleteam-Local-ExecIssues and PRs for the Execution (Local) teamtype: feature request
Extremely low performance of bazel when building a large project on macOS when compared to running CMake + make.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Build a large bazel project on macOS. I see that a lot of fsevents for files in /private/var/tmp/_bazel_user triggered and fseventsd seems to crawl at 100% - 200% CPU usage after them, slowing down the builds. I do have /private/var/tmp masked out in my spotlight configuration, but it does not seem to be enough.
What operating system are you running Bazel on?
Darwin grisu.dyndns.cern.ch 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
where you can for example do bazel build @root//:cling. Given this is a subset of tensorflow (i.e. the part which builds llvm), plus some extra stuff to build parts of clang, I am surprised this is not a common issue. Notice I build on my local laptop (2015 MBP) with no external cache.
Indeed; that commit may help and I'd be very interested to know if it does.
But I have also noticed fseventsd consuming lots of CPU (and, incidentally, this service runs at default priority -- so that commit actually makes Bazel run at a lower priority which is probably good). Haven't had a chance to dig into this. Maybe setting --nowatchfs would prevent the fseventsd activity, though then Bazel will be slower to detect file changes of course... (just thinking aloud). It just feels stupid that we have to waste so much CPU just to watch for file changes...
Thanks. I will try that when I have a bit of time. Notice also that the fsevents seem to be relative to stuff in /var/tmp/_bazel_user/, not in ~/src/myproject. Maybe I simply do not understand the bazel internals, but is that what you'd expect from the file watching process?
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.
I found that when exec bazel builds. macos is listening to the bazel workspace and bazel-out directory. I don't think the bazel-out directory should be included here.
ps: the watchfs option is false
We found a workaround: use a ramdisk or hdiutil to create a new tmp volume. Then, disable fseventsd for this volume to keep the CPU usage of the fseventsd process lower.
The Clang and Swift implicit module caches are inherently incompatible with hermetic builds and sandboxed execution. The only way to achieve the same degree of performance as the implicit module cache in a Bazel-like build is to explicitly precompile the modules as part of the build graph and propagate them as known inputs/outputs instead of dumping them into a single common directory.
P2We'll consider working on this in future. (Assignee optional)not staleIssues or PRs that are inactive but not considered staleteam-Local-ExecIssues and PRs for the Execution (Local) teamtype: feature request
Activity
irengrig commentedon Mar 1, 2019
Hello @ktf, thank you for your feedback.
Do you some particular project in mind that we can experiment with?
ktf commentedon Mar 2, 2019
What I have is:
https://github.com/ktf/AliceO2/tree/bazel-support
where you can for example do
bazel build @root//:cling. Given this is a subset of tensorflow (i.e. the part which builds llvm), plus some extra stuff to build parts of clang, I am surprised this is not a common issue. Notice I build on my local laptop (2015 MBP) with no external cache.irengrig commentedon Mar 2, 2019
Thank you for the example project!
Assigning to Apple team.
keith commentedon Mar 2, 2019
It might be worth trying to repro with this commit 0877340
jmmv commentedon Mar 2, 2019
Indeed; that commit may help and I'd be very interested to know if it does.
But I have also noticed fseventsd consuming lots of CPU (and, incidentally, this service runs at default priority -- so that commit actually makes Bazel run at a lower priority which is probably good). Haven't had a chance to dig into this. Maybe setting
--nowatchfswould prevent the fseventsd activity, though then Bazel will be slower to detect file changes of course... (just thinking aloud). It just feels stupid that we have to waste so much CPU just to watch for file changes...ktf commentedon Mar 3, 2019
Thanks. I will try that when I have a bit of time. Notice also that the fsevents seem to be relative to stuff in
/var/tmp/_bazel_user/, not in~/src/myproject. Maybe I simply do not understand the bazel internals, but is that what you'd expect from the file watching process?jmmv commentedon Mar 3, 2019
Yes. That's where the build artifacts are -- they are not stored in your source tree -- and Bazel has to watch them for out-of-band changes.
33 remaining items
Improve testing for deleteTree and deleteTreesBelow.
Move deleteTree and deleteTreesBelow into FileSystem and Path.
sgowroji commentedon Feb 16, 2023
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.
brentleyjones commentedon Feb 16, 2023
This is still relevant.
Kila2 commentedon Jun 24, 2024
I found that when exec bazel builds. macos is listening to the bazel workspace and bazel-out directory. I don't think the bazel-out directory should be included here.
ps: the watchfs option is false
ktf commentedon Sep 5, 2024
Any update on this?
Kila2 commentedon Sep 5, 2024
We found a workaround: use a ramdisk or
hdiutilto create a new tmp volume. Then, disablefseventsdfor this volume to keep the CPU usage of thefseventsdprocess lower.nickdesaulniers commentedon Nov 6, 2025
This would be nice to have. Is the assignee for this issue stale?
nickdesaulniers commentedon Nov 6, 2025
@allevato do you have an example of this?