Skip to content

Fixed data race in test-setup.sh #26453

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

excitoon
Copy link
Contributor

@excitoon excitoon commented Jul 1, 2025

Please check this out; on some platforms PIDs may be reused without wraparound.

There are two Issues (solved) here:

  • child process may quit before we started to retrieve his exit code;
  • another process may take his place.

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Jul 1, 2025
@fmeum fmeum requested a review from meisterT July 1, 2025 14:55
# We need to wait in a loop because wait is interrupted by any incoming trapped
# signal (https://www.gnu.org/software/bash/manual/bash.html#Signals).
while kill -0 $childPid 2>/dev/null; do
if [[ "$targetExited" == "1" ]]; then
. "${targetExitCodeFile}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this deserves a comment that this will read the exit code from the file.

Btw, is there a scenario where we didn't write the file?

exitCode=$?
echo "exitCode=$exitCode" > "${targetExitCodeFile}"
kill -SIGCHLD $PPID
while [[ 1 ]]; do sleep 1; done # Stasis.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required?

@iancha1992 iancha1992 added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jul 8, 2025
@meteorcloudy meteorcloudy added team-Local-Exec Issues and PRs for the Execution (Local) team and removed team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review PR is awaiting review from an assigned reviewer team-Local-Exec Issues and PRs for the Execution (Local) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants