Skip to content

fix(process): bound timeouts by reaping the owned SSH process group #87

Closed

Description

@abruption

Problem

run() in src/process.ts kills only the immediate child on a timeout or output overflow, and then waits for the child's close event. A descendant that inherited the stdio pipes keeps them open, so close is delayed until that descendant exits. The jump ProxyCommand added for #20 is such a descendant (an ssh -W helper started by OpenSSH).

A reviewer reproduced this with a real ssh, a local no-network ProxyCommand helper that ran for 2 s, and a 500 ms run() timeout. At about 650 ms the parent was dead but the helper was still alive and the promise was unresolved. It returned only at about 2.4 s. A longer-lived descendant would delay completion further, and its descendant would outlive the CLI.

Scope and completion criteria

  • POSIX: start each child in its own process group. On a timeout or output overflow, kill that group only (process.kill(-pid, 'SIGKILL'), ignoring ESRCH). No PID scans and nothing outside the group.
  • Bounded completion: after the kill, stop reading the pipes and complete on the child's exit plus a short fixed grace, not on the pipes closing.
  • A detached group no longer receives the terminal's Ctrl-C: forward SIGINT, SIGTERM and SIGHUP to the CLI as a group kill, then exit with the original signal.
  • Windows: kill the child, destroy the streams and return at the deadline. Document that descendants may linger (--ssh-jump is refused on Windows clients).
  • Classification unchanged: a preflight timeout is a pre-submit refusal, a request timeout is unknown with no retry. Existing timeouts are not increased.
  • Regression tests with a self-contained helper that starts a pipe-holding grandchild: a tight return bound, the child and the grandchild both gone, a signal-forwarding case, and the interrupted classification.

Related

Found during review of the typed jump routing for #20. The fix lands in the #20 pull request.

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added 2 commits that reference this issue on Oct 2, 2026
    cbe29df
    f96c565
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions