Skip to content

Daemon processes leak indefinitely on Windows - idle timeout never fires after proxy disconnects via EPIPE #692

@guileryu01

Description

@guileryu01

Environment

  • OS: Windows 11 Enterprise (10.0.22631)
  • codegraph: 0.9.5
  • Node (bundled): 25.2.1 (via --liftoff-only)
  • Claude Code: VS Code extension 2.1.162 + CLI (~/.local/bin/claude.exe)

Summary

After prolonged use of Claude Code (VS Code extension and CLI) with the codegraph MCP server, node.exe processes accumulate without bound and eventually saturate CPU at 100%. Closing a Claude session — via VS Code panel close or CLI /exit — does not terminate the associated codegraph daemon processes. The 5-minute idle timeout (CODEGRAPH_DAEMON_IDLE_TIMEOUT_MS = 300 000 ms) never fires.


Observed state

Task Manager's Processes tab showed ~16 Node.js JavaScript Runtime entries (it collapses child processes). The Details tab reveals 49 node.exe processes in total. Querying via wmic and cross-referencing parent PIDs against the live process list:

  PID      PPID     TYPE    PARENT STATUS
  -------  -------  ------  --------------------
    2644    25336   daemon  parent alive
    3564    22580   daemon  parent alive
    4592    28652   shim    ORPHAN - parent dead   <--- stuck
    4872    34868   daemon  parent alive
    8788    32824   daemon  parent alive
    9296    37076   daemon  parent alive
    9796    31472   daemon  parent alive
   14916    36524   shim    ORPHAN - parent dead   <--- stuck
   18312    34512   daemon  parent alive
   18448    31288   daemon  parent alive
   22324    30900   daemon  parent alive
   22580    25392   shim    ORPHAN - parent dead   <--- stuck
   23328    29508   shim    ORPHAN - parent dead   <--- stuck
   24256    37812   daemon  parent alive
   25336    42792   shim    parent alive
   27584     9624   shim    ORPHAN - parent dead   <--- stuck
   27884    34868   shim    parent alive
   30328    35224   daemon  parent alive
   30900    29452   shim    ORPHAN - parent dead   <--- stuck
   31004    54108   daemon  parent alive
   31288     5308   shim    ORPHAN - parent dead   <--- stuck
   31472    47392   shim    ORPHAN - parent dead   <--- stuck
   32824    54316   shim    ORPHAN - parent dead   <--- stuck
   34512    55924   shim    parent alive
   35040    36508   daemon  parent alive
   35224    20360   shim    parent alive
   36460    45044   shim    ORPHAN - parent dead   <--- stuck
   36508    41276   shim    ORPHAN - parent dead   <--- stuck
   37076    36840   shim    ORPHAN - parent dead   <--- stuck
   37812    39348   shim    ORPHAN - parent dead   <--- stuck
   38632    42364   shim    parent alive
   38760    41316   daemon  parent alive
   40032    54612   daemon  parent alive
   40504    54328   daemon  parent alive
   41076    52916   shim    ORPHAN - parent dead   <--- stuck
   41316    30244   shim    ORPHAN - parent dead   <--- stuck
   42276    27584   daemon  parent alive  (but parent shim 27584 is orphaned)
   43904    51608   daemon  parent alive  (but parent shim 51608 is orphaned)
   45292    38632   daemon  parent alive
   46124    36056   shim    ORPHAN - parent dead   <--- stuck
   51608    44984   shim    ORPHAN - parent dead   <--- stuck
   51716    50140   shim    ORPHAN - parent dead   <--- stuck
   51744    51716   daemon  parent alive  (but parent shim 51716 is orphaned)
   54108     3948   shim    ORPHAN - parent dead   <--- stuck
   54256    41076   daemon  parent alive  (but parent shim 41076 is orphaned)
   54328    55096   shim    ORPHAN - parent dead   <--- stuck
   54336    55224   shim    ORPHAN - parent dead   <--- stuck
   54612    53536   shim    ORPHAN - parent dead   <--- stuck
   54628    54168   shim    ORPHAN - parent dead   <--- stuck

  Total: 49   Directly orphaned: 23   Live parent: 26

Daemon log evidence

.codegraph/daemon.log for one project shows 8 daemon starts and only 5 shutdowns — 3 daemons have leaked. The leaked daemons all share the same pattern: socket error: write EPIPE with no subsequent Shutting down line:

  [CodeGraph daemon] Listening on \\.\pipe\codegraph-66044fc27f64968e (pid 30244, v0.9.5). Idle timeout 300000ms.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph MCP] Caught up 2 file(s) changed since last run
[CodeGraph daemon] Shutting down (idle timeout; clients=0).
[CodeGraph daemon] Listening on \\.\pipe\codegraph-26006b39a474179c (pid 23800, v0.9.5). Idle timeout 300000ms.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] Another daemon (pid 23800) already holds the lock; exiting.
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph MCP] Caught up 1 file(s) changed since last run
[CodeGraph daemon] Another daemon (pid 23800) already holds the lock; exiting.
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph daemon] Another daemon (pid 23800) already holds the lock; exiting.
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph daemon] Listening on \\.\pipe\codegraph-66044fc27f64968e (pid 15464, v0.9.5). Idle timeout 300000ms.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] Shutting down (idle timeout; clients=0).
[CodeGraph daemon] Listening on \\.\pipe\codegraph-26006b39a474179c (pid 37656, v0.9.5). Idle timeout 300000ms.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] Another daemon (pid 37656) already holds the lock; exiting.
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph MCP] Caught up 1 file(s) changed since last run
[CodeGraph MCP] Auto-synced 1 file(s) in 1425ms
[CodeGraph MCP] Auto-synced 1 file(s) in 1385ms
[CodeGraph MCP] Auto-synced 1 file(s) in 1411ms
[CodeGraph daemon] Another daemon (pid 37656) already holds the lock; exiting.
[CodeGraph daemon] Shutting down (idle timeout; clients=0).
[CodeGraph daemon] Listening on \\.\pipe\codegraph-26006b39a474179c (pid 27136, v0.9.5). Idle timeout 300000ms.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] Another daemon (pid 27136) already holds the lock; exiting.
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph MCP] Auto-synced 19 file(s) in 4338ms
[CodeGraph daemon] Shutting down (idle timeout; clients=0).
[CodeGraph daemon] Another daemon (pid 37100) already holds the lock; exiting.
[CodeGraph daemon] Listening on \\.\pipe\codegraph-26006b39a474179c (pid 37100, v0.9.5). Idle timeout 300000ms.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] Shutting down (idle timeout; clients=0).
[CodeGraph daemon] Listening on \\.\pipe\codegraph-26006b39a474179c (pid 37480, v0.9.5). Idle timeout 300000ms.
[CodeGraph daemon] Another daemon (pid 37480) already holds the lock; exiting.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph MCP] Caught up 18 file(s) changed since last run
[CodeGraph MCP] Auto-synced 1 file(s) in 1793ms
[CodeGraph daemon] Listening on \\.\pipe\codegraph-26006b39a474179c (pid 36460, v0.9.5). Idle timeout 300000ms.
[CodeGraph daemon] Another daemon (pid 36460) already holds the lock; exiting.
[CodeGraph MCP] File watcher active — graph will auto-sync on changes
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph daemon] socket error: write EPIPE
[CodeGraph MCP] Auto-synced 1 file(s) in 4648ms
[CodeGraph MCP] Auto-synced 1 file(s) in 2706ms
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph MCP] Auto-synced 1 file(s) in 2888ms
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph daemon] Another daemon (pid 36460) already holds the lock; exiting.
[CodeGraph daemon] Another daemon (pid 36460) already holds the lock; exiting.
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph MCP] Auto-synced 1 file(s) in 2148ms
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph MCP] Auto-synced 1 file(s) in 3057ms
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph MCP] Auto-synced 1 file(s) in 2357ms
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] File watcher error {
  error: "Error: EBUSY: resource busy or locked, watch 'c:\\dev\\xxxxxxxx"
}
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph MCP] Auto-synced 1 file(s) in 3552ms
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed
[CodeGraph] File watcher error {
  error: "Error: EBUSY: resource busy or locked, watch 'c:\\dev\\xxxxxxxx"
}
[CodeGraph] File watcher error {
  error: "Error: EBUSY: resource busy or locked, watch 'c:\\dev\\xxxxxxxx"
}
[CodeGraph] Watch sync failed { error: 'FOREIGN KEY constraint failed' }
[CodeGraph MCP] Auto-sync error: FOREIGN KEY constraint failed

No Shutting down for either of the last two daemons.

Contrast with daemons that did clean up — they also received EPIPE errors but eventually logged:

  [CodeGraph daemon] Shutting down (idle timeout; clients=0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions