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 — MCP server processes not cleaned up on exit (orphan processes) + eagerly starts all servers · Issue #30123 · anomalyco/opencode

MCP server processes not cleaned up on exit (orphan processes) + eagerly starts all servers #30123

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
MCP server processes not cleaned up on exit (orphan processes) + eagerly starts all servers#30123
Copy link
Assignees
Hona

Description

@chenyuan35
chenyuan35
opened on May 31, 2026
Issue body actions

Bug Description

When OpenCode exits, MCP server child processes are not killed, leaving orphan processes running indefinitely. Additionally, OpenCode eagerly starts ALL configured stdio-type MCP servers at launch regardless of whether they will be used.

Impact

  • 30 orphan node.exe processes accumulated (from just 2 sessions), each consuming 45-75MB RAM
  • Total wasted memory: ~1.5GB
  • CPU fan noise due to unnecessary load

Root Cause

  1. Process tree: OpenCode -> cmd /c npx -y -> node(npx-cli.js) -> node(MCP server)
  2. When OpenCode exits, it does not cascade SIGTERM/kill to child processes
  3. The cmd /c wrapper exits early (by design of /c), making npx and MCP server orphans
  4. Windows does not auto-clean orphan processes — they run forever waiting on closed stdin

All MCP servers are started eagerly

Even if a session never uses avily, exa, memory, sequential-thinking, or context7, all of them are launched at startup. This wastes CPU and memory on every session.

Expected Behavior

  1. On exit: OpenCode should kill all spawned child processes (the entire process tree)
  2. On startup: MCP servers should be lazily started only when first needed (or at least have a config option for this)
  3. Alternatively: MCP servers should detect stdin EOF and exit themselves

Environment

  • Windows (Win32)
  • OpenCode (latest)
  • MCP servers launched via: \cmd /c npx -y @modelcontextprotocol/server-sequential-thinking\ (and similar)

Workaround

Users can manually kill orphan processes:
\\powershell
taskkill /f /im node.exe
\\

Or disable unused MCP servers in opencode.json to prevent them from starting.

Reacted by Kristian Flamsted

Activity

  1. github-actions
    assigned
    Hona
    on May 31, 2026
  2. github-actions commented on May 31, 2026

    @github-actions
    github-actionsBot
    on May 31, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • local MCP server child processes become orphaned on restart #30073: local MCP server child processes become orphaned on restart
    • Local stdio MCP servers leak processes on disconnect / replace / rollback #26714: Local stdio MCP servers leak processes on disconnect / replace / rollback
    • Bug: Shared OpenCode host keeps per-directory MCP child processes alive on Windows after switching routed directories/worktrees #21557: Shared OpenCode host keeps per-directory MCP child processes alive on Windows after switching directories
    • Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up #19168: Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up

    If your issue is distinct (e.g., the eager startup behavior or the Windows-specific cmd /c process tree issue), please clarify what is not covered by the above issues.

  3. github-actions commented on Jul 31, 2026

    @github-actions
    github-actionsBot
    on Jul 31, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  4. github-actions
    closed this as not plannedon Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Hona
    Hona

Labels

No labels
No labels

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.