Skip to content

fix: don't wait forever for a child that ignores SIGTERM - #648

Open
ykhrustalev wants to merge 1 commit into
sourcefrog:mainfrom
ykhrustalev:ykhrustalev/terminate-grace
Open

ykhrustalev wants to merge 1 commit into
sourcefrog:mainfrom
ykhrustalev:ykhrustalev/terminate-grace

Conversation

@ykhrustalev

@ykhrustalev ykhrustalev commented Sep 16, 2026

Copy link
Copy Markdown

Problem
On a timeout, terminate() sends one SIGTERM and then blocks in wait() with no bound. A cargo process that ignores the signal, or that has been stopped and so never receives it, hangs the whole run at that point.

Solution

  • Waits only a short grace period after SIGTERM, then SIGKILLs the process group.
  • Moves the killpg errno handling into a signal_group() helper, since two signals are now sent.

Testing

  • Existing timeout and interrupt tests pass unchanged on macOS and Linux.
  • No new test: reaching the escalation needs the cargo process itself to ignore or not receive SIGTERM, which cargo doesn't do in normal operation (it is reachable via SIGSTOP).

Split out of #647 as requested. This is the first of a series and stands on its own; next in the stack: #650 (process-group sweep) → #652 (report why a scenario died).

On a timeout, terminate_child() sent one SIGTERM and then blocked in wait()
with no bound. A cargo process that ignores the signal, or that has been
stopped and so never receives it, hung the whole run at that point.

Wait only for a short grace period, then SIGKILL the process group. This
needs a second signal, so the errno handling moves into a signal_group()
helper rather than being duplicated.
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