Skip to content

Windows: MCP process trees are never reaped — PR #15516 is skipped on this platform, and stdio servers are eagerly started regardless of use #52251

Closed as not planned

Description

@Bruce-Yii

This is Windows-specific follow-up evidence for the two behaviors described here, with measurements. It is not a duplicate of the process-tree mechanics — the fix in #15516 is explicitly skipped on Windows, so this platform has no reaping at all.

Setup

  • Windows 11, 15.7 GB RAM
  • 12 configured MCP servers: 4 type: "local" (stdio), 8 type: "remote" (HTTP)
  • The local ones: playwright (cmd /c npx -y @playwright/mcp@latest), cloudflare (npx -y @cloudflare/mcp-server-cloudflare run <id>), notion (npx -y @notionhq/notion-mcp-server), fetch (uvx mcp-server-fetch)

Measurement 1 — remote vs local is the dividing line

With 8 remote servers configured, zero of them produced a local node.exe. The 8 local ones did. That part behaves as described in #30123.

Measurement 2 — one agent episode leaked +43 processes

Clean baseline: 376 processes. Ran one opencode run episode (~60s). Afterwards: 419.

process before after delta
uv.exe 7 9 +2
uvx.exe 7 9 +2
mcp-server-fetch.exe 6 8 +2
node.exe 25 33 +8
cmd.exe 25 33 +8
conhost.exe 38 48 +10
python.exe 15 21 +6
opencode.exe 1 3 +2
total 376 419 +43

The service crashed during this run. Across a longer session the same accumulation reproduced: 637 processes vs a 376 clean baseline, i.e. 19 uv.exe chains vs 7. Reboot cleared the 12 surplus chains.

Measurement 3 — duplicate spawn, matches #31554

node.exe command lines attributed:

what copies RSS
@playwright/mcp@latest 14 1,315 MB
@cloudflare/mcp-server-cloudflare 14 1,099 MB
all 8 remote servers 0 0

The 9 other configured servers (github, tavily, firecrawl, brightdata, exa, context7, notion-remote, fetch, kimi-cu) contributed no node.exe. 2,414 MB total, from 2 of 4 local servers.

On a later occasion the same playwright server reached 52 concurrent copies / 4,892 MB, then dropped back to 1 on its own. So the multiplier is not stable at 2-4.

Why Windows has no mitigation

#15516 walks the descendant tree with pgrep -P and SIGTERMs each descendant before client.close(). The PR states it is skipped on Windows where pgrep is unavailable, so StdioClientTransport.close() signals only the direct child. On this platform the cmd /c wrapper exits early by design, leaving node grandchildren reparented and waiting on a closed stdin indefinitely.

#30123 already lists the fix directions. Concretely, what would help on Windows:

  1. Replace the pgrep -P walk with a platform tree walk — e.g. build descendants from CreateToolhelp32Snapshot / Process32First on Windows, so fix: kill orphaned MCP child processes and expose OPENCODE_PID on shu… #15516's existing logic can be enabled there.
  2. Handle the cmd /c case explicitly. cmd /c exiting early is expected; a bare descendant walk from the direct child is not sufficient once the wrapper is gone. taskkill /T /F /PID on the direct child at least reaches the tree.
  3. Lazy stdio startup, per MCP server processes not cleaned up on exit (orphan processes) + eagerly starts all servers #30123. In the config above, notion runs alongside a separate notion-remote entry pointing at mcp.notion.com, so at least one local server is plausibly unnecessary — but eager start means it is launched regardless of whether the session ever calls it.

One process-level detail worth separating

The parent opencode.exe process itself also grows with conversation length and never releases: measured 489 → 537 → 621 → 699 → 1,308 → 1,869 MB over a single long session, monotonically, with no plateau. That is the session context heap, not the MCP leak, and it is not covered by the issues above. Reporting it only because it was conflated with the MCP leak for a while on my side and made attribution harder.

Activity

  1. github-actions commented on Sep 30, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Please use the Bug Report issue template and include its required Description field. The current body contains useful details but does not follow one of the required issue templates.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Sep 30, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

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

Metadata

Metadata

Assignees

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