You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode-pty daemon never reaps exited children (zombies accumulate) #64829
On macOS (Darwin 25.5.0), with opencode v2.3.0, the opencode-pty daemon 0.5.2 (~/.cache/opencode/bin/opencode-pty/0.5.2-ed3adb8c7531fef5) never reaps the shell processes it starts once they exit.
After two days of uptime, the daemon had 353 zombie children: ps -Ao stat,ppid | awk '$1 ~ /Z/ && $2==<daemon pid>' | wc -l. The count grows with every finished background shell job and only drops when the daemon exits.
Zombies use no CPU, but each holds a process-table slot, so a long-running server will eventually reach the per-user process limit.
Expected: the daemon calls waitpid (or handles SIGCHLD) for each child it spawns, as soon as that child exits.
Steps: run opencode serve, start and finish a few hundred background shell jobs through the pty tool, then count Z processes whose parent is the daemon.
Thanks for the clear report and the zombie count. I think this is a duplicate of #63817: on 2.3.0, the opencode-pty daemon 0.5.2 leaves finished shell commands as zombie children.
These issues report the same problem or a related one, ordered from most to least likely:
The fix is in #64266, which makes the daemon reap each shell command when it exits and released @opencode/pty 0.6.0. #64251 then made OpenCode use 0.6.0, and the current code pins @opencode/pty 0.6.0. Please update OpenCode and restart the server, so that a new daemon starts. Then check that the daemon's path under ~/.cache/opencode/bin/opencode-pty/ shows 0.6.0, not 0.5.2.
I'm closing this issue now as a duplicate of #63817. If zombies still build up with the 0.6.0 daemon, please add your details to #63817, including the OpenCode version, the daemon version and the zombie count. Replying here will also reopen this issue.
Activity
opencodejr commentedon Nov 19, 2026
Thanks for the clear report and the zombie count. I think this is a duplicate of #63817: on 2.3.0, the
opencode-ptydaemon 0.5.2 leaves finished shell commands as zombie children.These issues report the same problem or a related one, ordered from most to least likely:
opencode-pty daemonon 2.3.0. It was reproduced and has since been closed as fixed.opencode-ptydaemon problem on macOS (each shell call stalls for about 5 seconds when the daemon fails to reconnect). It's listed only in case you see that too.The fix is in #64266, which makes the daemon reap each shell command when it exits and released
@opencode/pty0.6.0. #64251 then made OpenCode use 0.6.0, and the current code pins@opencode/pty0.6.0. Please update OpenCode and restart the server, so that a new daemon starts. Then check that the daemon's path under~/.cache/opencode/bin/opencode-pty/shows 0.6.0, not 0.5.2.I'm closing this issue now as a duplicate of #63817. If zombies still build up with the 0.6.0 daemon, please add your details to #63817, including the OpenCode version, the daemon version and the zombie count. Replying here will also reopen this issue.