bazel: Bazel stuck during remote execution
Description of the bug:
Bazel build current state
[65,456 / 65,465] PackageZip ...rcejar.jar; 20129s remote
when there is no such issue observed this run takes less than a minute if not less than 10s.
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.
There is no easy way to reproduce it and some noticeable % of our RBE runs are stuck forever without Bazel finishing properly.
Here is the thread dump of Bazel server and there is no activity on RBE side workers at the same time
Which operating system are you running Bazel on?
5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jan 3 15:54:45 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
What is the output of bazel info release?
release 7.0.1
If bazel info release returns development 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?
We do have the following in .bazelrc
common:remote --jobs=300
common:remote --remote_timeout=3600
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 54 (24 by maintainers)
Commits related to this issue
- Don't upload remote input to remote cache and when it's missing, treat it as remote cache eviction. Also revert the workaround for #19513. Fixes #21777. Potential fix for #21626 and #21778. Closes... — committed to bazelbuild/bazel by coeuvre 3 years ago
- Don't upload remote input to remote cache and when it's missing, treat it as remote cache eviction. Also revert the workaround for #19513. Fixes #21777. Potential fix for #21626 and #21778. Closes... — committed to iancha1992/bazel by coeuvre 3 years ago
- Don't upload remote input to remote cache (#21851) and when it's missing, treat it as remote cache eviction. Also revert the workaround for #19513. Fixes #21777. Potential fix for #21626 and #... — committed to bazelbuild/bazel by iancha1992 3 years ago
- Don't upload remote input to remote cache and when it's missing, treat it as remote cache eviction. Also revert the workaround for #19513. Fixes #21777. Potential fix for #21626 and #21778. Closes... — committed to iancha1992/bazel by coeuvre 3 years ago
- [7.1.2] Don't upload remote input to remote cache (#21941) and when it's missing, treat it as remote cache eviction. Also revert the workaround for #19513. Fixes #21777. Potential fix for #216... — committed to bazelbuild/bazel by iancha1992 3 years ago
I was able to reproduce a hang but the stack trace is different. I am not sure whether they share the same root cause.
In the mean time, can you check whether your build hangs with
--remote_download_all? (If it doesn’t, then I know the root cause)Thanks for the stacktraces and pointers to the potential root cause. I will try to reproduce it locally now and hopefully come up with a fix.
I’ve attached a compressed thread dump from a recent occurrence of this issue jvm.tdump.gz. Hopefully this helps identify the culprit. @jasonschroeder-sfdc @dkashyn-sfdc
This issue has recurred under bazel 7.2. I have a stuck java process awaiting countdown latches for all ensureInputsPresent running.
stuck-7.2.0.jstack.txt
@coeuvre could you please tell where we can get the custom Bazelisk-ready version that contains the fix? Rolling releases seems having only 7.0 and 8.0 pre-releases and I don’t see any 7.1 and 7.2 nightly builds here https://bazel.build/release/rolling
Yes, the fix will be merged into 7.2.
No pressure! I will keep this issue open (but with a lower priority) for the time being. Feel free to close it once you can verify the fix.
@coeuvre will this be merged to 7.2? Patching is hard and we not even fully moved to 7.1 yet… I’d rather try to repro this with 7.0 like before and then switch to “head” of 7.2 to see whether the issue is there.
My CAS state is changing and evictions and cleanup not happening recently. This is why I’m unable to repro currently. Yet we are verifying some CAS-related issue with BuildFarm and I hope to get to the point when CAS is mutating again to trigger the issue for us.
Can you patch https://github.com/bazelbuild/bazel/commit/eda0fe4399b85d3bbc39fda2701287e014ecb919 and check whether this issue is still reproducible?
In the interest of not hijacking this issue, can you file a separate one @joeljeske against a performance regression between 6.4.0. and 7.1.1?
tl;dr: run it more than once, and run it against buildfarm. You need to see all the content for actions already in the CAS to exhibit this.
The point of the changes to async-task-cache (aside from the short circuit), are to make the client attempt to upload numerous blobs that are already uploaded, and to try to upload many blobs across actions that are the same (to have high consumer counts for the AsyncTaskCache).
If your remote implementation test case does not terminate duplicate blob uploads with committedSize responses on first observation, you may not get the behavior I’m seeing. When I run this against buildfarm, which informs writers of a blob already existing with an early response and completion, I see hangs without the short circuit (sometimes only for the remote_timeout), and with the short circuit it completes quickly on all actions.
From the stack trace, it’s highly likely. Would you mind patching https://github.com/bazelbuild/bazel/commit/294c904c30fe305f60e548a438940d5ab60a15b4 on top of 7.0.1 to give it a try?
I recommend not using
--experimental_remote_execution_keepalive.