Skip to content

MCP process leak: 35 orphaned codegraph processes (1.7GB) + C:\ drive indexer (1GB) #3747

@Diarica

Description

@Diarica

Environment

  • Reasonix: 1.4.0-canary.3
  • codegraph: v0.9.7 (bundled)
  • OS: Windows 11

Summary

After a Reasonix session, 35 orphaned codegraph serve --mcp processes survived, consuming ~1,753 MB. One additional instance with --path C:\ ate 1,048 MB indexing the entire system drive. Total: ~2.8 GB leaked before manual kill.

Details

1. Mass orphaned processes (35 instances, ~1,753 MB)

All spawned within 1 second (08:51:35–36), each by a unique cmd.exe parent:

cmd.exe /c ...\codegraph.cmd serve --mcp

Every cmd.exe parent is already dead — the node.exe children were never reaped:

  • 33 instances: no --path, ~48–50 MB each
  • 1 instance: --path C:\PersonalData\Development\Projects\VectorCraft, 78 MB
  • 1 instance: --path C:\Users\...\reasonix\global-workspace, 57 MB

Every process is byte-identical — these are failed MCP connection retries that accumulated.

2. C:\ root indexer (1,048 MB, manually killed)

PID 26244
Parent PID 4292 (another codegraph serve --mcp, also dead)
WorkingSet: 1,073,368 K
CommandLine: codegraph serve --mcp --path C:\
Created: 2026-06-10 08:55:41

This process was indexing the entire C drive — C:\Windows, C:\Program Files, everything. Unbounded memory growth until killed.

Root Cause

Reasonix spawns codegraph via cmd.exe /c codegraph.cmd serve --mcp. When the MCP handshake fails or times out, Reasonix kills (or lets exit) the cmd.exe wrapper — but node.exe survives as an orphan:

  1. No process group kill — killing cmd.exe doesn't propagate to node.exe
  2. No self-termination — codegraph has no watchdog; when the MCP stdio pipe closes it doesn't exit
  3. No dedup — each retry spawns a brand new pair, old ones linger

The --path C:\ case is a separate concern — Reasonix somehow resolved the workspace to C:\ and passed that to codegraph, triggering unbounded filesystem indexing.

Expected Fix (Reasonix side)

  1. Kill the process group (or at least the child node.exe), not just the cmd.exe shell
  2. Deduplicate — don't spawn a new MCP server if one is already running for the same path
  3. Enforce a maximum lifespan / idle timeout on MCP server processes
  4. Guard the --path argument — never pass a filesystem root to codegraph

Screenshot

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentCore agent loop (internal/agent, internal/control)data-lossData loss (sessions, config, history)mcpMCP servers / plugins (internal/plugin, codegraph)windowsWindows-specific

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions