Bazel `info` -> `cquery` invalidate part of cache
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
Running:
1 - `bazel info`
2 - `bazel cquery target`
3 - `bazel run/build target`
Invalidate part of cache (for example, suddenly npm modules start extracting, but must be taken from cache). For more info see reproduction steps
### Which category does this issue belong to?
Core
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Add to `~/.bazelrc`:
```
common --experimental_check_output_files=false
common --noexperimental_check_external_repository_files
```
1 - `git clone https://github.com/bazelbuild/examples.git` - Clone examples repo
2 - `cd frontend` - go to frontend example.
3 - `bazel build //next.js:next` - build application
4 - `bazel build //next.js:next` - check build is from cache
5 - `bazel info && bazel cquery //next.js:next && bazel build //next.js:next`
After step 5, in logs (`bazel info server_log`) we see there were `Extracting npm package` (building without info and cquery doesn't have extracting npm package):
```
240514 09:51:17.209:I 6609 [com.google.devtools.build.lib.runtime.BuildSummaryStatsModule.buildComplete] Critical Path: 0.08s, Remote (0.00% of the time): [parse: 0.00%, queue: 0.00%, network: 0.00%, upload: 0.00%, setup: 0.00%, process: 0.00%, fetch: 0.00%, retry: 0.00%, processOutputs: 0.00%, other: 0.00%, input files: 0, input bytes: 0, memory bytes: 0]
0.00s action 'JsRunBinary next.js/.next'
0.00s action 'Transpiling & type-checking TypeScript project @@//next.js/pages:pages [tsc -p next.js/tsconfig.json]'
0.00s action 'Transpiling & type-checking TypeScript project @@//next.js/pages/api:api [tsc -p next.js/tsconfig.json]'
0.08s action 'Extracting npm package next@13.0.5_-1955910335'
240514 09:51:17.209:I 6609 [com.google.devtools.build.lib.runtime.BuildSummaryStatsModule.buildComplete] Slowest actions:
0.08s action 'Extracting npm package next@13.0.5_-1955910335'
0.04s action 'Extracting npm package next@13.0.5_-1955910335 [for tool]'
0.04s action 'Copying directory packages/one/one'
0.04s action 'Extracting npm package @babel/generator@7.23.5 [for tool]'
0.02s action 'Extracting npm package scheduler@0.23.0 [for tool]'
0.02s action 'Extracting npm package @babel/types@7.23.5 [for tool]'
0.02s action 'Extracting npm package react-dom@18.2.0_react_18.2.0'
0.02s action 'Extracting npm package styled-jsx@5.1.0_986221465 [for tool]'
0.02s action 'Extracting npm package kind-of@3.2.2'
0.02s action 'Extracting npm package @babel/helper-hoist-variables@7.22.5 [for tool]'
0.02s action 'Extracting npm package @babel/helper-module-transforms@7.23.3_at_babel_core_7.23.5 [for tool]'
0.02s action 'Extracting npm package supports-color@5.5.0 [for tool]'
0.02s action 'Extracting npm package is-number@6.0.0'
0.01s action 'Extracting npm package @babel/helper-validator-option@7.23.5 [for tool]'
0.01s action 'Extracting npm package caniuse-lite@1.0.30001542'
0.01s action 'Extracting npm package @babel/helper-environment-visitor@7.22.20 [for tool]'
0.01s action 'Extracting npm package @babel/parser@7.23.5 [for tool]'
0.01s action 'Extracting npm package @babel/generator@7.23.5'
0.01s action 'Extracting npm package @babel/traverse@7.23.5 [for tool]'
0.01s action 'Extracting npm package @jridgewell/trace-mapping@0.3.19 [for tool]'
0.01s action 'Extracting npm package @babel/parser@7.23.5'
0.01s action 'BazelWorkspaceStatusAction stable-status.txt'
0.01s action 'Extracting npm package typescript@4.9.3'
0.01s action 'Extracting npm package @babel/template@7.22.15'
0.01s action 'Extracting npm package @babel/helper-function-name@7.23.0 [for tool]'
0.01s action 'Extracting npm package @babel/core@7.23.5 [for tool]'
0.01s action 'Extracting npm package @babel/template@7.22.15 [for tool]'
0.01s action 'Extracting npm package postcss@8.4.14'
0.01s action 'Extracting npm package @babel/helper-compilation-targets@7.22.15'
0.01s action 'Extracting npm package semver@6.3.1 [for tool]'
240514 09:51:17.212:I 6609 [com.google.devtools.build.lib.sandbox.AsynchronousTreeDeleter.setThreads] Resizing async tree deletion pool to 4 threads
240514 09:51:17.212:I 6609 [com.google.devtools.build.lib.runtime.CacheFileDigestsModule.logStats] Accumulated cache stats after command: hit count=63355, miss count=17619, hit rate=0.782412, eviction count=0
240514 09:51:17.212:I 6609 [com.google.devtools.build.lib.runtime.CacheFileDigestsModule.logStats] Cache stats for finished command: hit count=12671, miss count=1, hit rate=0.999921, eviction count=0
```
### Which operating system are you running Bazel on?
macos
### What is the output of `bazel info release`?
release 7.1.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?
https://github.com/bazelbuild/bazel/issues/17914
### Any other information, logs, or outputs that you want to share?
`GrpcServerImpl.executeCommand` logs, without --client-env (removed it)
```
240515 12:10:24.009:I 8721 [com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand] [info, --startup_time=32, --command_wait_time=0, --extract_data_time=0, --binary_path=/Users/user_name/Library/Caches/bazelisk/downloads/sha256/fb5e7bc62fc3c8f2511e3b64d795296444129b26f13d8dece4d4cee1845b758f/bin/bazel, --rc_source=client, --default_override=0:common=--isatty=1, --default_override=0:common=--terminal_columns=156, --rc_source=/Users/user_name/trash/examples/frontend/.bazelrc, --rc_source=/Users/user_name/.bazelrc, --default_override=1:common=--@aspect_rules_ts//ts:skipLibCheck=always]
240515 12:10:24.097:I 8721 [com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand] [cquery, --startup_time=21, --command_wait_time=0, --extract_data_time=0, --binary_path=/Users/user_name/Library/Caches/bazelisk/downloads/sha256/fb5e7bc62fc3c8f2511e3b64d795296444129b26f13d8dece4d4cee1845b758f/bin/bazel, --rc_source=client, --default_override=0:common=--isatty=1, --default_override=0:common=--terminal_columns=156, --rc_source=/Users/user_name/trash/examples/frontend/.bazelrc, --rc_source=/Users/user_name/.bazelrc, --default_override=1:common=--@aspect_rules_ts//ts:skipLibCheck=always, //next.js:next]
240515 12:10:24.223:I 8721 [com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand] [build, --startup_time=21, --command_wait_time=0, --extract_data_time=0, --binary_path=/Users/user_name/Library/Caches/bazelisk/downloads/sha256/fb5e7bc62fc3c8f2511e3b64d795296444129b26f13d8dece4d4cee1845b758f/bin/bazel, --rc_source=client, --default_override=0:common=--isatty=1, --default_override=0:common=--terminal_columns=156, --rc_source=/Users/user_name/trash/examples/frontend/.bazelrc, --rc_source=/Users/user_name/.bazelrc, --default_override=1:common=--@aspect_rules_ts//ts:skipLibCheck=always, //next.js:next]
```
Contributor guide
Assessment
This issue has not been assessed yet.