Ensure that sandboxed processes exit before their sandboxes are clean… #18641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ed up (Cherry-pick of #18632)
As @jsirois discovered and described in
#16778 (comment), because the
local::CommandRunner
does notwait
for its child process to have exited, it might be possible for a SIGKILL to not have taken effect on the child process before its sandbox has been torn down. And that could result in the process seeing a partial sandbox (and in the case of #16778, potentially cause named cache corruption).This change ensures that we block to call
wait
when spawning local processes by wrapping them in theManagedChild
helper that we were already using for interactive processes. It then attempts to clarify the contract of theCapturedWorkdir
trait (but in order to improve cherry-pickability does not attempt to adjust it), to make it clear that child processes should fully exit before therun_and_capture_workdir
method has returned.Fixes #16778 🤞.
Co-authored-by: John Sirois [email protected]
(cherry picked from commit 1462bef)