bazelbuild / bazelbuild/reclient
bug: shared directory output (e.g. clang crashreports) fails with racing
- Dominant language
- Go
- Stars
- 114
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/bazelbuild/reclient/commit/35813b877b5fbf0fe69bb558c15ed239a816c226 introduced a directory type output to clang actions, which is shared among all actions of this type (with a `-fcrash-diagnostics-dir` option on). However, in `racing` strategy, this results in the following error:
```
reclient[b1872204-b036-4d9d-85ca-575109a989fd]: LocalErrorResultStatus: b1872204-b036-4d9d-85ca-575109a989fd: cannot move directory ../../tools/clang/crashreports from /projects/brave-browser-3/src/out/android_Release_x86/.reproxy_tmp/racing/b1872204-b036-4d9d-85ca-575109a989fd/src/out/android_Release_x86 to /projects/brave-browser-3/src/out/android_Release_x86: rename /projects/brave-browser-3/src/out/android_Release_x86/.reproxy_tmp/racing/b1872204-b036-4d9d-85ca-575109a989fd/src/tools/clang/crashreports /projects/brave-browser-3/src/tools/clang/crashreports: file exists
```
This is because [here](https://github.com/bazelbuild/reclient/blob/56e9e1d545955595b9c7fc1d5500088418f91fe5/internal/pkg/reproxy/action.go#L577) we're trying to use `os.Rename` to move the output directory from the temporary `racing` directory, and the directory already exists, because it was populated by a different action.
I'm not sure what is the intended behavior of the shared output directory -- as I understand the current code, any output gets [removed](https://github.com/bazelbuild/remote-apis-sdks/blob/master/go/pkg/client/cas_download.go#L519) before it is downloaded, so it looks to me like the behavior is badly defined when multiple actions share an output directory.
If the intended behavior was to **aggregate** outputs from multiple actions in the same `../../tools/clang/crashreports` directory, then this will need to be fixed both in the SDK and Reclient, IIUC.
Contributor guide
Assessment
This issue has not been assessed yet.