Skip to content

"I/O exception during sandboxed execution" "Directory not empty" with --experimental_reuse_sandbox_directories #19935

@jfirebaugh

Description

@jfirebaugh

Description of the bug:

--experimental_reuse_sandbox_directories can produce non-hermetic behavior when attempting to reuse a sandbox stash that contains a directory where a file is needed.

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.

Minimal example: https://github.com/jfirebaugh/bazel_experimental_reuse_sandbox_directories_bug

Clone this repository, and run bazel build --repo_env=CREATE_DIRECTORY=1 --experimental_reuse_sandbox_directories genrule followed by bazel build --repo_env=CREATE_DIRECTORY=0 --experimental_reuse_sandbox_directories genrule (the only difference between the two is the CREATE_DIRECTORY value). The second command will fail with:

ERROR: <workspace>/BUILD.bazel:1:8: Executing genrule //:genrule failed: I/O exception during sandboxed execution: <output_base>/sandbox/darwin-sandbox/18/execroot/__main__/external/repository/output (Directory not empty)

If the second command is modified to remove the use of --experimental_reuse_sandbox_directories, then it succeeds. It also succeeds if you delete the sandbox stash (rm -rf "$(bazel info output_base)/sandbox/sandbox_stash").

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

release 6.4.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 master; git rev-parse HEAD ?

n/a

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No

Have you found anything relevant by searching the web?

No

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

No response

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)team-Local-ExecIssues and PRs for the Execution (Local) teamtype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions