Skip to content

Fix xharness watchdog process cleanup in apple and android runners#16637

Open
akoeplinger wants to merge 1 commit intodotnet:mainfrom
akoeplinger:fix/xharness-watchdog-cleanup
Open

Fix xharness watchdog process cleanup in apple and android runners#16637
akoeplinger wants to merge 1 commit intodotnet:mainfrom
akoeplinger:fix/xharness-watchdog-cleanup

Conversation

@akoeplinger
Copy link
Copy Markdown
Member

Fixes the noisy error on normal (non-timeout) runs:

  ./xharness-runner.apple.sh: line 187: 4322 Killed: 9  sleep "$command_timeout"

This happened because the watchdog's sleep process was still running when the command finished, and the shell reported its termination. The original code never cleaned up the watchdog since it didn't track its PID.

Changes:

  • Capture the watchdog PID (WATCHDOG_PID) and kill it after the command finishes, then wait on it to suppress the 'Killed' message.
  • Rename PID to COMMAND_PID for clarity.
  • Remove the inner '&' inside the watchdog subshell that caused the sleep && kill chain to be double-backgrounded, making the captured PID point to an already-exited subshell instead of the actual sleeper.
  • Remove the redundant explicit subshell (...) since backgrounding with '&' already implies one.

Fixes the noisy error on normal (non-timeout) runs:
  ./xharness-runner.apple.sh: line 187: 4322 Killed: 9  sleep "$command_timeout"

This happened because the watchdog's sleep process was still running
when the command finished, and the shell reported its termination. The
original code never cleaned up the watchdog since it didn't track its
PID.

Changes:
- Capture the watchdog PID (WATCHDOG_PID) and kill it after the command
  finishes, then wait on it to suppress the 'Killed' message.
- Rename PID to COMMAND_PID for clarity.
- Remove the inner '&' inside the watchdog subshell that caused the
  sleep && kill chain to be double-backgrounded, making the captured PID
  point to an already-exited subshell instead of the actual sleeper.
- Remove the redundant explicit subshell (...) since backgrounding with
  '&' already implies one.
@akoeplinger akoeplinger requested a review from premun March 27, 2026 16:20
@akoeplinger akoeplinger enabled auto-merge (squash) March 27, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant