[6.2.0]Use less subshells and tee
s in running tests with bazel run
.
#17869
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.
Fixes #17754.
What we have seen prior to this change was that sometimes for quick tests the output was swallowed. After a lot of poking it became clear that the culprit is the use of subshell and
tee
, e.g. if you removetee
completely from the picture the behavior never shows up.The issue is that with a fast test,
tee
seems to be killed (or its parent subshell) before the printing the output to stdout.With this change, we reduce the number of subshells and processes to set up and reduce the chance of the race condition but not remove it.
However, for practical purposes, the race condition is gone.
With the reproduction steps in #17754, and this command
a bazel from head fails ~3900 out of 10000 times.
After this commit, it never failed.
Closes #17846.
Commit: c04f0d4
PiperOrigin-RevId: 518794237
Change-Id: I8c1862d3a274799b864f0f5f42b85d6df5af78c7