Skip to content

opencode-pty daemon never reaps exited children (zombies accumulate) #64829

Closed as duplicate

Description

@oppianmatt

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.

Activity

  1. opencodejr commented on Nov 19, 2026

    @opencodejr
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions