bazel: Bazel is stuck fetching external repositories
Description of the bug:
We have reports of Bazel consistently hanging during fetching of external repositories. Particular, those consumed with git_override / git_repository.
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.
I do not have a reproducible example or a way to consistently reproduce this. When this happens it’s been reported that it’ll consistently hang even on server restarts. The only thing that helps is restarting the users machine until they eventually hit it again.
Which operating system are you running Bazel on?
macOS 14
What is the output of bazel info release?
release 6.5.0
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?
I’ve found some other threads in Slack and issues on GitHub related to hanging but nothing that seems like this.
Any other information, logs, or outputs that you want to share?
Some information about our environment:
- We are using arm64 machines
- Xcode 15.1 toolchains
- Bzlmod enabled (without lockfile)
Our reporter also managed collect 3 jstack traces when the Bazel command was hung. I’ve attached those below. bazel_jstack_trace.log
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- Disable git fsmonitor in git_worker to fix hangs when fetching repositories This commit adds the `-c core.fsmonitor=false` arguments to all git commands (excluding `git init`) in `git_worker.bzl`. Th... — committed to bazelbuild/bazel by luispadron 2 years ago
- Disable git fsmonitor in git_worker to fix hangs when fetching repositories This commit adds the `-c core.fsmonitor=false` arguments to all git commands (excluding `git init`) in `git_worker.bzl`. Th... — committed to adam-singer/bazel by luispadron 2 years ago
- Disable git fsmonitor in git_worker to fix hangs when fetching repositories This commit adds the `-c core.fsmonitor=false` arguments to all git commands (excluding `git init`) in `git_worker.bzl`. Th... — committed to bazel-io/bazel by luispadron 2 years ago
- [7.4.0] Disable git fsmonitor in git_worker to fix hangs when fetching repositories (#23647) This commit adds the `-c core.fsmonitor=false` arguments to all git commands (excluding `git init`) in `gi... — committed to bazelbuild/bazel by bazel-io 2 years ago
So I believe (with the testing I’ve done) that https://github.com/bazelbuild/bazel/pull/23626 solves this issue within
git_worker.I performed tests by spawning many file watchers using the
fswatchtool, using a released Bazel version7.3.1when runningbazel fetchin theexamples/lots_of_reposdirectory of the branch: https://github.com/cgrindel/rules_swift_package_manager/tree/luis/lots-of-repo-example I was able to consistently reproduce stuck fetches.I confirmed that building
//src:bazeland using that instead consistently allows all fetches to continue and I ran into no hangs during the process.Thanks for the reply. I also found this discussion. I am trying the –experimental_worker_for_repo_fetching set to
off.since it sounds like this is some problem with
git, I’m going to go ahead and close this. Feel free to reopen if this is actually Bazel-related.just from a brief look at the 3 stack traces, they seem to be hung on different things. I couldn’t immediately tell what the first two are about, but the third one seems to be waiting for the
gitsubprocess to exit. Is thegitprocess still alive when you took the stack trace?