bazelbuild / bazelbuild/bazel

Changing --worker_extra_flag does not invalidate cache

Open
#26,418 2 comments 0 reactions 1 assignee Claimed by @bigelephant29 View on GitHub
P3 stale team-Local-Exec type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Changing `--worker_extra_flag` does not cause actions to be executed with new flags. Need to execute `bazel clean` to use new values.

### 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.

Got:
```
$ git clone https://github.com/bazelbuild/examples bazel-examples
$ cd bazel-examples/java-tutorial
$ bazel build //:ProjectRunner
...
INFO: 8 processes: 5 internal, 2 linux-sandbox, 1 worker.
INFO: Build completed successfully, 8 total actions

$ bazel build //:ProjectRunner --worker_extra_flag=Javac=--some-invalid-flag
...
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
```

Expected:
```
$ bazel clean
$ bazel build //:ProjectRunner --worker_extra_flag=Javac=--some-invalid-flag
...
BazelJavaBuilder threw exception: unknown option : '--persistent_worker'
```
After cleaning cache getting expected error, as default java worker does not support extra worker flags.

### Which operating system are you running Bazel on?

Ubuntu 20.04

### What is the output of `bazel info release`?

release 8.3.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` ?

```text
https://github.com/bazelbuild/examples
6f37bcdc6e71023409a03ea047369c5a6f754862
```

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.