Skip to content

fix(runner): run tear_down for a test killed by the timeout - #1333

Merged
Chemaclass merged 1 commit into
mainfrom
fix/1324-timeout-skips-tear-down
Aug 20, 2026
Merged

fix(runner): run tear_down for a test killed by the timeout#1333
Chemaclass merged 1 commit into
mainfrom
fix/1324-timeout-skips-tear-down

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1324

The watchdog kills a timed-out test with a group SIGTERM, and bash runs no EXIT trap for a fatal signal it has no trap for. cleanup_on_exit never fired, so tear_down was skipped and whatever set_up acquired for that test was leaked. The file-scoped hook already survived, because the runner loop carries on to the next file, so the two halves of the pair behaved differently for one kill.

💡 Changes

  • Trap TERM in the test-body subshell and exit 143, handing control to the EXIT trap where tear_down already lives.
  • Best effort by design. The watchdog SIGKILLs the group 0.3s later, so a tear_down slower than that grace is cut off: a hook that never returns must not outlive the timeout it is cleaning up after.
  • The grace is left at 0.3s rather than widened. Measured with the full parallel suite running as load, the new acceptance test passed 10 out of 10.
  • Both --no-parallel and --parallel now run the per-test hook on a timeout.

The watchdog kills a timed-out test with a group SIGTERM, and bash runs no
EXIT trap for a fatal signal it has no trap for. cleanup_on_exit never
fired, so tear_down was skipped and whatever set_up acquired for that test
was leaked. The file-scoped hook already survived, because the runner loop
carries on to the next file, which left the two halves of the pair
behaving differently for one kill.

Trap TERM in the test-body subshell and exit 143, handing control to the
EXIT trap where tear_down already lives.

Best effort by design: the watchdog SIGKILLs the group 0.3s later, so a
tear_down slower than that grace is cut off. A hook that never returns
must not outlive the timeout it is cleaning up after. The grace is left as
it was; measured against the full parallel suite running as load, the
acceptance test passed 10 times out of 10.

Closes #1324
@Chemaclass Chemaclass added the bug Something isn't working label Aug 19, 2026
@Chemaclass Chemaclass self-assigned this Aug 19, 2026
@Chemaclass
Chemaclass merged commit 003538a into main Aug 20, 2026
85 of 87 checks passed
@Chemaclass
Chemaclass deleted the fix/1324-timeout-skips-tear-down branch August 20, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants