Repository navigation
Fix: --timeout does not stop a hung client - #599
sholub-dev wants to merge 2 commits into
Conversation
JosephDoUrden
left a comment
There was a problem hiding this comment.
Tested this locally on macOS. src/runner/client.test.ts is 5/5 green, and the new test times out on main, so it does catch the bug. I tried to break it: a grandchild that ignores SIGTERM, 3 hung clients in parallel, a setsid escapee, SIGINT and SIGTERM to the runner. The runner settled every time. One gap: closing the terminal (SIGHUP to the runner's process group) now leaves the client running. On main it shared the group and got the hangup too. Adding 'SIGHUP' to the list in trackClient (exit 129) fixed it for me. Otherwise LGTM once CI runs.
|
Good catch. Applied in 0e465b0. |
JosephDoUrden
left a comment
There was a problem hiding this comment.
Re-ran on 0e465b0. src/runner/client.test.ts is 5/5. SIGHUP to the runner or to its process group now exits 129 and takes the client with it, including one that ignores TERM, HUP and INT. On 8a04171 the same SIGHUP left the client running, so the fix is real. SIGINT, SIGTERM and --timeout still behave. macOS only, lgtm.
Fixes #598
--timeoutdidn't stop a hung client when it was started through a shell, so the runner hung forever and left the client running. The client now runs in its own process group and the whole group is killed on timeout. The group is also killed if the runner exits or gets Ctrl+C, since a separate group no longer receives the terminal's signal. On Windows it usestaskkill /T.Before:
--timeout 3000with a client that never exits ran until killed by hand. After: it reportsClient timed out after 3000msand exits, with no leftover process.Tests: added a case in
src/runner/client.test.tswith a hung client behind a command list. It hangs on main and passes with this change. Lint, type check and the runner tests pass.