Skip to content

Conversation

@deepak1556
Copy link
Contributor

For microsoft/vscode#182212

The ptmx leak was from low_fds[0] that was always opened and never closed. Drive by improvement for error propagation and failure case cleanups.

Tyriar
Tyriar previously approved these changes Jan 28, 2026
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failing, unrelated?

Tyriar
Tyriar previously approved these changes Jan 28, 2026
@deepak1556 deepak1556 merged commit af053f2 into main Jan 28, 2026
9 checks passed
@deepak1556 deepak1556 deleted the robo/fix_ptmx_leak_macos branch January 28, 2026 21:28
speakman added a commit to speakman/happy that referenced this pull request Feb 10, 2026
node-pty v1.1.0 has an off-by-one bug in pty_posix_spawn() on macOS
where low_fds[0] (allocated via posix_openpt()) is never closed due
to a buggy cleanup loop (`count > 0` vs the correct `i <= count`).
This leaks 1 PTY master fd per pty.spawn() call, eventually exhausting
all 511 PTY pairs on macOS (kern.tty.ptmx_max).

Upstream fix: microsoft/node-pty#882 (merged 2026-01-28).

Also fixes the abort handler to kill the entire process group (-pid)
with SIGTERM instead of sending SIGHUP to just the launcher PID,
ensuring the Claude binary grandchild is also terminated.
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.

3 participants