Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox reuse preserves test_tmp directory #21253

Closed
fmeum opened this issue Feb 8, 2024 · 7 comments
Closed

Sandbox reuse preserves test_tmp directory #21253

fmeum opened this issue Feb 8, 2024 · 7 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Local-Exec Issues and PRs for the Execution (Local) team type: bug

Comments

@fmeum
Copy link
Collaborator

fmeum commented Feb 8, 2024

Description of the bug:

The _tmp directory created for tests is preserved in the sandbox stash.

While I haven't benchmarked the effect of this, it would at least waste disk space and may also negatively affect performance of sandbox reuse.

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.

No response

Which operating system are you running Bazel on?

No response

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

@fmeum
Copy link
Collaborator Author

fmeum commented Feb 8, 2024

Cc @oquenchil @lberki

@fmeum
Copy link
Collaborator Author

fmeum commented Feb 8, 2024

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Feb 8, 2024
@sgowroji sgowroji added the team-Local-Exec Issues and PRs for the Execution (Local) team label Feb 8, 2024
@keertk
Copy link
Member

keertk commented Feb 8, 2024

@bazel-io fork 7.1.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Feb 8, 2024
@oquenchil
Copy link
Contributor

Hey Fabian, are you sure about this?

I see here that we are only stashing the execroot from the sandboxBase. The _hermetic_tmp directory is a sibling of the execroot.

The testing code I wrote to repro this isn't giving me any hermetic tmp directory being copied into the stash. Under sandboxBase/execroot/$TEST_WORKSPACE/, I do see a _tmp directory. It would be good not to copy that one too but it's not related to the hermetic tmp dir. Is that the one you meant? As far as I can see that would only be created for test rules though. Was this prompted by the test rules in rules_oci?

Thanks!

@fmeum
Copy link
Collaborator Author

fmeum commented Feb 12, 2024

Thanks for investigating and sorry for the false alarm - I saw the _tmp and thought that it was the hermetic tmp dir.

@fmeum fmeum closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2024
@oquenchil
Copy link
Contributor

Oh I can still fix the _tmp one. I think it makes total sense not to stash that in tests.

@fmeum fmeum reopened this Feb 12, 2024
@fmeum fmeum changed the title Sandbox reuse preserves hermetic /tmp directory. Sandbox reuse preserves test_tmp directory Feb 12, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Feb 12, 2024

I updated title and description.

@zhengwei143 zhengwei143 added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Feb 13, 2024
oquenchil added a commit that referenced this issue Feb 20, 2024
Test actions create a `_tmp` directory that doesn't make sense to stash between different test actions when using `--reuse_sandbox_directories`. This change makes sure that doesn't happen by deleting the directory before stashing.

Closes #21412.

Fixes #21253.

PiperOrigin-RevId: 608566281
Change-Id: I7186f8e5eba7b3110b10963df69ec66cd1402b2c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Local-Exec Issues and PRs for the Execution (Local) team type: bug
Projects
None yet
Development

No branches or pull requests

8 participants