bazel: Bazel's own integration tests fail locally on Linux
Description of the bug:
Many of Bazel’s own integration tests fail locally on Linux with an error such as the following:
src/main/tools/linux-sandbox-pid1.cc:280: "The sandbox working directory cannot be below a path where we mount tmpfs (you requested mounting /tmp/bazel-working-directory/_main/_tmp/74701f16efd616fedbad9bb8b36df803/root/0a1489a1de031466aaaf200f31c5b29b/sandbox/linux-sandbox/1/execroot/_main in /tmp). Is your --output_base= below one of your --sandbox_tmpfs_path values?": Invalid argument
This appears to be due to a combination of the outer Bazel process now running with --incompatible_sandbox_hermetic_tmp and the inner Bazel process running with --sandbox_tmpfs_path=/tmp due to
https://github.com/bazelbuild/bazel/blob/055e25b75c74d1e2c4c71694a938b6456323facc/src/test/shell/testenv.sh.tmpl#L261
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.
bazel test //src/test/shell/bazel:bazel_rules_cc_test --test_output=errors
Which operating system are you running Bazel on?
Linux
What is the output of bazel info release?
No response
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 master; 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?
No response
Any other information, logs, or outputs that you want to share?
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 25 (22 by maintainers)
Commits related to this issue
- Rewrite paths of writable directories that are under the execroot. This is necessary because that paths of those directories are different when seen by Bazel and by the processes within the sandbox a... — committed to bazelbuild/bazel by lberki 3 years ago
- Always add containing trees of input tree file artifacts to the metadata map. This happens for action templates. The reason is that the Linux sandbox needs to know where the tree file artifact is ma... — committed to bazelbuild/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to bazelbuild/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to bazel-io/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to bazel-io/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to bazel-io/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to bazel-io/bazel by lberki 3 years ago
- Always add containing trees of input tree file artifacts to the metadata map. This happens for action templates. The reason is that the Linux sandbox needs to know where the tree file artifact is ma... — committed to iancha1992/bazel by lberki 3 years ago
- Rewrite paths of writable directories that are under the execroot. This is necessary because that paths of those directories are different when seen by Bazel and by the processes within the sandbox a... — committed to iancha1992/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to iancha1992/bazel by lberki 3 years ago
- Always add containing trees of input tree file artifacts to the metadata map. This happens for action templates. The reason is that the Linux sandbox needs to know where the tree file artifact is ma... — committed to iancha1992/bazel by lberki 3 years ago
- Rewrite paths of writable directories that are under the execroot. This is necessary because that paths of those directories are different when seen by Bazel and by the processes within the sandbox a... — committed to iancha1992/bazel by lberki 3 years ago
- Add tree artifact metadata for the coverage post-processing spawn. This makes --experimental_split_coverage_postprocessing work in the wake of https://github.com/bazelbuild/bazel/commit/fb6658c86164b... — committed to iancha1992/bazel by lberki 3 years ago
- [7.1.0] Fixes for Bazel's own integration tests fail locally on Linux (#20822) Includes 3 commits. https://github.com/bazelbuild/bazel/commit/c48392c54a92b7bc5b04883bd6499c7a5677205d, https://github... — committed to bazelbuild/bazel by iancha1992 3 years ago
- [7.0.1] Fixes for Bazel's own integration tests fail locally on Linux (#20821) Includes 3 commits. https://github.com/bazelbuild/bazel/commit/c48392c54a92b7bc5b04883bd6499c7a5677205d, https://gi... — committed to bazelbuild/bazel by iancha1992 3 years ago
- Fix tests on linux in `upload_all_java_tools.sh` Tempoarily workaround https://github.com/bazelbuild/bazel/issues/20753 to unblock https://github.com/bazelbuild/java_tools/issues/87 Setting `--sandb... — committed to bazelbuild/bazel by hvadehra 3 years ago
- Remove spawn_strategy on account of #20753 — committed to fzakaria/bazel by fzakaria 3 years ago
- Remove spawn_strategy on account of #20753 — committed to fzakaria/bazel by fzakaria 3 years ago
- Preserve paths under hermetic `/tmp` in the sandbox The bind mounting scheme used with the Linux sandbox' hermetic `/tmp` feature is modified to preserve all paths as they are outside the sandbox, wh... — committed to bazelbuild/bazel by fmeum 3 years ago
- [7.2.0] Preserve paths under hermetic `/tmp` in the sandbox The bind mounting scheme used with the Linux sandbox' hermetic `/tmp` feature is modified to preserve all paths as they are outside the san... — committed to fmeum/bazel by fmeum 3 years ago
I know that there are still failures, that’s why this bug is still open, but AFAICT they are not due to bugs in Bazel, but due to bugs in the test battery. That particular test is fixed by replacing an
ln -swith acp(otherwise, the final target of the symlink is under/tmp/bazel-source-rootsand the inner sandbox overwrites that directory)A thousand thanks and a bhattleship 😃
@lberki Here you go!: https://github.com/bazelbuild/bazel/pull/20821 https://github.com/bazelbuild/bazel/pull/20822
@meteorcloudy the last change to be cherry-picked (https://github.com/bazelbuild/bazel/commit/b0db044227d62178a7e578b8e03c452d8c17af33) is in; AFAIU there are no more issues related to this bug that are caused by an actual bug in Bazel, there are only ones that are caused by incompatibilities in its test battery. I have a change to fix one of those, too (cl/596858687 for the Android SDK) but it’s not urgent anymore.
So I’ll assume that the cherrypick to 7.0.1 will happen and demote this to P2.
I have a fix for the coverage issue. For my own records, it also requires setting the output user root to
/tmp/output_user_rootin the test framework to work, but that one change is enough to fix the actual bug in Bazel so let’s cherry-pick that to 7.0.1, too.@bazel-io fork 7.1.0
@bazel-io fork 7.0.1
wrt. Bazel 7.0.1, I propose we do the following:
/tmpin such a way that is specifically contraindicated with--incompatible_sandbox_hermetic_tmpIf (2) doesn’t make any more skeletons fall out from the closet, we call the fire drill done. If it does, well, that’s unfortunate.
@meteorcloudy WDYT?