Bazel 7.1.1 re-runs analysis and re-fetches external repositories during each invocations
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
After upgrade from bazel 7.0.2 to bazel 7.1.1 seeing an issue where bazel analysis cache is lost between invocations and "Analyzing: target"/"checking cached actions"/fetching external repositories run on each invocation vs being retained in-memory. Server pid doesnt check and there are no logs like `WARNING: something something has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed)`
Reverting https://github.com/bazelbuild/bazel/commit/18ba4492c752530b168daa563987400f7f9df4bb and related https://github.com/bazelbuild/bazel/commit/bd4bddf6a9359b363dc60a83b8da7083e738c202 solves this issue
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
_No response_
### Which operating system are you running Bazel on?
macOS
### What is the output of `bazel info release`?
7.1.1
### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
https://github.com/bazelbuild/bazel/commit/18ba4492c752530b168daa563987400f7f9df4b
### Any other information, logs, or outputs that you want to share?
Logs from running same build command several times in a row
Expected (7.0.2 behavior)
```
INFO: Invocation ID: c6749968-4795-4107-a952-b03bb0899d56
Computing main repo mapping:
Loading:
Loading: 0 packages loaded
Analyzing: target //Apps/Foo:Foo (0 packages loaded, 0 targets configured)
Analyzing: target //Apps/Foo:Foo (0 packages loaded, 0 targets configured)
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
INFO: Analyzed target //Apps/Foo:Foo (0 packages loaded, 0 targets configured).
[28,051 / 37,230] checking cached actions
INFO: Found 1 target...
Target //Apps/Foo:Foo up-to-date:
bazel-bin/Apps/Foo/Foo.app
INFO: Elapsed time: 8.511s (0.14m), Critical Path: 0.56s (0.01m)
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
```
Actual (7.1.1):
```
INFO: Invocation ID: baf1cdaa-c43e-4a4e-9301-1df575e25f64
Computing main repo mapping:
Computing main repo mapping:
Computing main repo mapping:
Computing main repo mapping:
Computing main repo mapping:
Computing main repo mapping:
Loading:
Loading: 2 packages loaded
Analyzing: target //Apps/Foo:Foo (3 packages loaded)
Analyzing: target //Apps/Foo:Foo (3 packages loaded, 0 targets configured)
Analyzing: target //Apps/Foo:Foo (3 packages loaded, 0 targets configured)
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
Analyzing: target //Apps/Foo:Foo (4815 packages loaded, 55237 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (9950 packages loaded, 134275 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10023 packages loaded, 155924 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10244 packages loaded, 163078 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10244 packages loaded, 163078 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10244 packages loaded, 163078 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10247 packages loaded, 163483 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10247 packages loaded, 163483 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10248 packages loaded, 180673 targets configured)
[1 / 1] checking cached actions
Analyzing: target //Apps/Foo:Foo (10251 packages loaded, 207048 targets configured)
[1 / 1] checking cached actions
INFO: Analyzed target //Apps/Foo:Foo (10251 packages loaded, 236964 targets configured).
[64,876 / 92,099] [Scann] Compiling Features/Bar/Sources/Bar.m
[72,967 / 92,099] [Scann] Compiling Libraries/Baz/Internal/Baz.m
[77,410 / 92,099] [Scann] Compiling Features/Qux/Sources/Qux.m
[81,359 / 92,099] checking cached actions
[83,679 / 92,099] checking cached actions
[85,643 / 92,099] checking cached actions
INFO: Found 1 target...
Target //Apps/Foo:Foo up-to-date:
bazel-bin/Apps/Foo/Foo.app
INFO: Elapsed time: 69.108s (1.15m), Critical Path: 1.58s (0.03m)
INFO: 11 processes: 10 remote cache hit, 1 internal.
INFO: Build completed successfully, 11 total actions
```
Contributor guide
Research direction
Start by comparing the referenced commits 18ba4492c752530b168daa563987400f7f9df4bb and bd4bddf6a9359b363dc60a83b8da7083e738c202, then reproduce the repeated build on macOS with Bazel 7.1.1 using the reported logs. Compare it with Bazel 7.0.2 and verify that analysis caching and external repository fetching are retained between invocations.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100