Bug Description
After running qwen -y for long sessions, the process leaks PTY file descriptors (/dev/ptmx) and eventually exhausts system PTY capacity.
When this happens, tmux can no longer create panes/windows.
Environment
- OS: macOS 15.5 (Darwin 24.5.0)
- Shell: zsh
- tmux: 3.6a
- qwen CLI launched as:
qwen -y
- Node runtime observed in process tree
Expected Behavior
qwen -y should not continuously accumulate PTY descriptors.
tmux should continue to split panes/create windows normally.
Actual Behavior
After long-running qwen sessions:
tmux split-window / tmux new-window fails with:
create window failed: fork failed: Device not configured
- Python PTY test fails with:
OSError('out of pty devices')
Diagnostics
- Kernel PTY max observed:
kern.tty.ptmx_max: 511
- One
qwen -y node process held ~444 /dev/ptmx descriptors
- Another
qwen -y process held ~50 /dev/ptmx descriptors
- Top PTY holders showed qwen dominating PTY usage
- After killing those qwen processes:
- PTY allocation worked immediately (
openpty ok)
- tmux pane split worked again
Minimal Reproduction (long-run)
- Start
qwen -y and keep it running with multiple tool/task operations for many hours.
- Periodically check PTY usage:
lsof -nP /dev/ptmx | awk 'NR>1{c[$2]++; cmd[$2]=$1} END{for (p in c) printf "%5d %s %s\\n", c[p], p, cmd[p]}' | sort -nr | head
- Observe qwen process PTY count continuously increasing.
- Eventually
tmux split-window fails with the error above.
Notes
This appears to be a PTY/FD cleanup leak in long-lived qwen sessions.
Please investigate PTY lifecycle management and child process teardown paths.
Bug Description
After running
qwen -yfor long sessions, the process leaks PTY file descriptors (/dev/ptmx) and eventually exhausts system PTY capacity.When this happens, tmux can no longer create panes/windows.
Environment
qwen -yExpected Behavior
qwen -yshould not continuously accumulate PTY descriptors.tmux should continue to split panes/create windows normally.
Actual Behavior
After long-running qwen sessions:
tmux split-window/tmux new-windowfails with:create window failed: fork failed: Device not configuredOSError('out of pty devices')Diagnostics
kern.tty.ptmx_max: 511qwen -ynode process held ~444/dev/ptmxdescriptorsqwen -yprocess held ~50/dev/ptmxdescriptorsopenpty ok)Minimal Reproduction (long-run)
qwen -yand keep it running with multiple tool/task operations for many hours.tmux split-windowfails with the error above.Notes
This appears to be a PTY/FD cleanup leak in long-lived qwen sessions.
Please investigate PTY lifecycle management and child process teardown paths.