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 — pty: opencode-pty daemon leaks zombie shell children (never reaped) · Issue #64270 · anomalyco/opencode

pty: opencode-pty daemon leaks zombie shell children (never reaped) #64270

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
pty: opencode-pty daemon leaks zombie shell children (never reaped)#64270
Copy link
Labels
area/serviceBackground service and serverplatform/linuxLinuxtype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@lidaobing
lidaobing
opened on Nov 16, 2026
Issue body actions

Title

pty: opencode-pty daemon leaks zombie shell children (never reaped)

Body

Summary

The opencode-pty daemon that executes shell-tool commands never reaps its
finished children, so every shell command leaves a zombie process. The daemon
is long-lived and shared across sessions, so the zombies accumulate without
bound (~150 observed after ~3 days of normal use).

Environment

  • opencode version: v2.3.0
  • OS: Ubuntu 24.04, Linux 7.0.0-42-generic x86_64
  • Terminal: VS Code (TERM_PROGRAM=vscode, TERM=xterm-256color, COLORTERM=truecolor)
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: none found in config

Reproduction

  1. Start an opencode session and run a few shell-tool commands (ls,
    git status, a pipeline like make ... | tail, etc.).
  2. After each command finishes, run:
    ps -eo stat,ppid,pid,cmd | awk '$1 ~ /^Z/'
  3. Every finished command is still listed as <defunct> with the
    opencode-pty daemon PID as parent, and stays there.

Expected Behavior

Finished shell commands are reaped by the pty daemon; no zombie processes
accumulate over time.

Actual Behavior

Zombies accumulate indefinitely. After ~3 days of use with a shared daemon:

$ ps -eo stat,ppid,pid,cmd | awk '$1 ~ /^Z/ {print $4}' | sort | uniq -c | sort -rn
    101 [bash]
     26 [sed]
     14 [git]
      5 [tail]
      1 [make]
      1 [grep]

All of them share the same parent:

  PID  PPID     ELAPSED CMD
380876  ...  2-22:25:28 ~/.cache/opencode/bin/opencode-pty/0.5.2-bc9cb0fa0ebb4e56/opencode-pty \
    daemon --runtime-dir ~/.local/state/opencode/pty --name <uuid>

The oldest zombies date back to ~2d20h, i.e. since that daemon started.
Not just the pipeline leader is affected: sed/tail/grep pipeline
children also end up parented to the daemon and are never reaped either.

Additional Context

  • Sending kill -CHLD <daemon pid> does not trigger reaping.
  • Restarting the daemon clears the zombies (they are reparented to init and
    reaped), but that is disruptive to active sessions' terminals.
  • Impact so far is only PID-slot usage, but the growth is unbounded and
    proportional to executed shell commands, so long-lived installs will hit it.
  • Reproducible consistently: each shell command reliably adds one or more
    zombies.

Activity

  1. opencodejr commented on Nov 16, 2026

    @opencodejr
    opencodejrBot
    on Nov 16, 2026
    Contributor
    More actions

    Thanks for the detailed report. I think this is a duplicate of #63817, which reports this leak and has been reproduced on 2.3.0.

    Possible duplicates and related issues, ordered by likelihood:

    • pty: shell commands leave zombies under opencode-pty daemon on Linux (2.3.0) #63817: the same problem. Every finished shell command stays <defunct> under the opencode-pty daemon (0.5.2) on 2.3.0, and the count grows over the daemon's lifetime. The reproduction there found that exited commands are only reaped once they drop out of the newest 25 per directory, so directories that go idle keep their zombies until the server restarts.
    • opencode-pty daemon leaks zombie child processes (unbounded growth under single daemon PID) #63976: another report of the same unbounded growth under a single daemon PID.
    • process-daemon: pipe children stay as zombies (steady-state 25 Z) until eviction; safe to reap once the process group is empty #64076: pipe children staying as zombies under the process daemon.
    • PRs fix(core): pin @opencode/pty 0.6.0 and use protocol 9 #64251 and fix(core): bound finished daemon shell commands across Locations #64037: open pull requests that address this.

    I'm closing this issue now as a duplicate of #63817. Please add your details there; your zombie breakdown across pipeline children (sed, tail, grep) and the note that kill -CHLD doesn't trigger reaping would be useful. If you think this is a different problem, reply here and the issue will reopen.

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