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 — Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up · Issue #19168 · anomalyco/opencode

Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up #19168

New issue
Copy link
New issue
Copy link
Closed
#19200
Closed
Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up#19168
#19200
Copy link
Assignees
rekram1-node
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

Description

@athal7
athal7
opened on Mar 25, 2026
Issue body actions

Description

Local MCP servers configured with "type": "local" (stdio transport) spawn a new process for every session opened, but the processes are never terminated when the session ends. Over time this leads to a large number of orphaned processes consuming significant memory.

Steps to reproduce

  1. Configure a local MCP in opencode.json, e.g.:
    "firefox-devtools": {
      "type": "local",
      "command": ["npx", "@padenot/firefox-devtools-mcp", "--firefox-path", "..."]
    }
  2. Open and close several sessions in OpenCode Desktop or the web UI
  3. Check running processes: ps aux | grep firefox-devtools-mcp

Expected behaviour

When a session ends, the stdio MCP child process it spawned should be terminated.

Observed behaviour

Each session spawns a new npm exec + node process pair. After ~12 sessions, 24 orphaned processes were running consuming ~1.2GB RSS combined. They are never cleaned up until the host process is restarted or they are killed manually.

Plugins

opencode-pty, opencode-wakatime

OpenCode version

v1.3.0

Operating System

macOS (Apple Silicon)

Terminal

Ghostty

Activity

  1. github-actions
    assigned
    rekram1-node
    on Mar 25, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    perfIndicates a performance issue or need for optimization
    on Mar 25, 2026
  3. github-actions commented on Mar 25, 2026

    @github-actions
    github-actionsBot
    on Mar 25, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • v1.1.6 still has memory bloat - heap not released + MCP orphan processes #7261: MCP orphan processes accumulate across sessions after crash/exit (same symptom: orphaned MCP child processes not cleaned up, reproduces with ps aux | grep)
    • Per-session MCP server and LSP duplication multiplies memory usage across concurrent sessions #13041: Per-session MCP server duplication multiplies memory usage across concurrent sessions (same root cause: each session spawns its own MCP processes without sharing or cleanup)
    • [Bug] Web UI spawns duplicate MCP server waves during active session #9230: Web UI spawns duplicate MCP server waves during a single session (related: runaway MCP process spawning)

    If your issue is distinct from these (e.g. specifically about the stdio/local transport teardown path rather than crash orphans or concurrent-session sharing), please clarify how it differs so it can be tracked separately.

  4. athal7 commented on Mar 26, 2026

    @athal7
    athal7
    on Mar 26, 2026
    ContributorAuthor
    More actions

    Thanks for the references. Checking each:

    • v1.1.6 still has memory bloat - heap not released + MCP orphan processes #7261: Primarily about orphans after a crash and Go heap arena accumulation — this issue is about clean normal-exit sessions also failing to clean up stdio child processes.
    • Per-session MCP server and LSP duplication multiplies memory usage across concurrent sessions #13041: About duplication across concurrent sessions sharing the same project — this issue is about sequential sessions each accumulating orphans.
    • [Bug] Web UI spawns duplicate MCP server waves during active session #9230: Web UI spawning duplicate MCP waves mid-session — different trigger (something causes a respawn while the session is still active).

    The specific case here is: after a clean session close (no crash, single session), the stdio/local-transport child processes are not terminated. The teardown path for type: local MCP connections doesn't appear to send SIGTERM to the child before the session is destroyed. Keeping this open as it's a distinct and more precisely scoped bug.

  5. kitlangton
    added 5 commits that reference this issue on Mar 26, 2026

    fix(mcp): close transport on failed/timed-out connections

    This issue will close once commit 860a7b8 is merged into the 'dev' branch.
    860a7b8

    fix(mcp): close transport on failed/timed-out connections

    This issue will close once commit 74d4ff1 is merged into the 'dev' branch.
    74d4ff1

    fix(mcp): close transport on failed/timed-out connections

    This issue will close once commit 141d912 is merged into the 'dev' branch.
    141d912

    fix(mcp): close transport on failed/timed-out connections

    This issue will close once commit ebdecf2 is merged into the 'dev' branch.
    ebdecf2
  6. kitlangton
    closed this as completedin #19200on Mar 26, 2026
  7. androidand
    added a commit that references this issue on Sep 19, 2026

    fix(mcp): close transport on failed/timed-out connections

    This issue will close once commit f4ef3b4 is merged into the 'dev' branch.
    f4ef3b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

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.