GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode-pty daemon does not reap exited pty session children (zombie accumulation) · Issue #65952 · anomalyco/opencode

opencode-pty daemon does not reap exited pty session children (zombie accumulation) #65952

New issue
Copy link
New issue
Copy link
Duplicate
Duplicate
opencode-pty daemon does not reap exited pty session children (zombie accumulation)#65952
Copy link
Labels
area/serviceBackground service and serverplatform/linuxLinuxtype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@MisterWanted
MisterWanted
opened on Nov 24, 2026
Issue body actions

Summary

opencode-pty daemon (v0.5.2, protocol 8) accumulates zombie processes: pty-session children that exit are never reaped, so they stay as zombies under the daemon PID until the daemon restarts.

Environment

  • opencode-pty 0.5.2 (bc9cb0fa0ebb4e56)
  • Running under opencode serve --service --hostname 0.0.0.0 --port 4096 (systemd user unit)
  • Ubuntu 25.10, kernel 6.x, aarch64 host

Observed

After ~2.5 days uptime:

$ ps -eo ppid,stat | awk '$2 ~ /Z/ {print $1}' | sort | uniq -c | sort -rn | head
     93 3135903

$ ps -o pid,ppid,stat,cmd -p 3135903
    PID    PPID STAT CMD
3135903 3135546 Ssl  /home/jan/.cache/opencode/bin/opencode-pty/0.5.2-bc9cb0fa0ebb4e56/opencode-pty daemon --runtime-dir /home/jan/.local/state/opencode/pty --name 56951b30-...

$ ps -eo pid,ppid,stat,cmd --ppid 3135903 | grep defunct | head
 482996 3135903 Z    [bash] <defunct>
 483497 3135903 Z    [python3] <defunct>
 483732 3135903 Z    [bash] <defunct>
  ...

93 zombie children (bash, python3, sed, node) under the daemon — all children of closed/ended pty sessions.

Expected

The daemon calls wait()/handles SIGCHLD for exited pty children so they don't linger as zombies.

Impact

On a long-running opencode serve host, zombies accumulate unboundedly (~40/day here) — table pollution, PID pressure, and misleading process inventory. Workaround: periodic daemon restart.

Reported after a fleet-wide process inventory sweep (witr).

Activity

  1. opencodejr commented on Nov 24, 2026

    @opencodejr
    opencodejrBot
    on Nov 24, 2026
    Contributor
    More actions

    Thanks for the detailed report. I think this is a duplicate of #63817: the same zombie build-up under opencode-pty daemon 0.5.2 (the same bc9cb0fa0ebb4e56 build), which has since been fixed.

    Related issues, ordered from most to least likely to be the same problem:

    • pty: shell commands leave zombies under opencode-pty daemon on Linux (2.3.0) #63817: shell commands leave zombies under opencode-pty daemon 0.5.2 on Linux. A commenter there reports zero zombies after updating to 0.6.0.
    • opencode-pty daemon leaks zombie child processes (unbounded growth under single daemon PID) #63976: unbounded zombie growth under a single daemon PID on Linux.
    • pty: opencode-pty daemon leaks zombie shell children (never reaped) #64270: the daemon leaks zombie shell children on Linux.
    • opencode-pty daemon never reaps exited children (zombies accumulate) #64829 and pty: opencode-pty daemon does not reap exited shells, leaving one zombie per tool call #65572: the same leak on macOS.

    The fix is in #64266: the daemon now reaps shell commands as soon as they exit (protocol 9, @opencode/pty 0.6.0). #64251 moved OpenCode to that release. Your daemon is still 0.5.2, so please upgrade OpenCode and restart opencode serve. Then check that the running daemon's path under ~/.cache/opencode/bin/opencode-pty/ shows 0.6.x.

    I'm closing this issue now as a duplicate of #63817. If zombies still build up after you upgrade, please add your details there. Replying here will also reopen this issue.

  2. opencodejr
    closed this as a duplicateof pty: shell commands leave zombies under opencode-pty daemon on Linux (2.3.0) #63817 on Nov 24, 2026
  3. opencodejr
    added
    area/serviceBackground service and server
    platform/linuxLinux
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 24, 2026
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

    area/serviceBackground service and serverplatform/linuxLinuxtype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.