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

Most upvoted comments

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 -s with a cp (otherwise, the final target of the symlink is under /tmp/bazel-source-roots and the inner sandbox overwrites that directory)

A thousand thanks and a bhattleship 😃

@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_root in 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:

  1. We cherry-pick https://github.com/bazelbuild/bazel/commit/c48392c54a92b7bc5b04883bd6499c7a5677205d and https://github.com/bazelbuild/bazel/commit/bc1d9d38bea907beea8fd82c362c9882ddf48cfd
  2. poke at our integration test battery to see if there are any more issues that are currently hidden by the fact that we in fact use /tmp in such a way that is specifically contraindicated with --incompatible_sandbox_hermetic_tmp

If (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?