Skip to content

macOS: codegraph serve opens excessive file descriptors and causes system instability #555

@yuadsl3010

Description

@yuadsl3010

Environment

  • OS: macOS
  • codegraph version: 0.9.6
  • Install: npm global package @colbymchenry/codegraph
  • Runtime observed: bundled codegraph-darwin-arm64/node

Problem

On macOS, codegraph serve --mcp appears to hold an extremely large number of open files. This eventually causes system-level abnormal behavior / instability.

Two running codegraph MCP server processes were the top file descriptor users:

lsof -n 2>/dev/null | awk '{print $2}' | sort | uniq -c | sort -nr | head -20
  61446 50283
  52886 50731
    578 4720
    502 4693
    424 60277
    ...

Process details:
PID 50283:
codegraph.js serve --mcp --path /Users/yuzhenchuan/code/food
Open files: 61446

PID 50731:
codegraph.js serve --mcp
Open files: 52886

Full process command:
/Users/yuzhenchuan/.nvm/versions/node/v18.20.8/lib/node_modules/@colbymchenry/codegraph/node_modules/@colbymchenry/codegraph-darwin-arm64/node --liftoff-only .../codegraph.js serve --mcp --path /Users/yuzhenchuan/code/food

Expect: codegraph serve --mcp should not keep tens of thousands of files open persistently, especially on macOS where file descriptor limits can affect the whole user session.
Actual: MCP server processes held ~61k and ~53k open files respectively. I had to kill them manually:

kill -9 50283 50731

Please investigate whether the macOS file watcher / indexing path is leaking file descriptors or watching too many files without filtering ignored directories such as .git, node_modules, generated files, or large dependency trees.

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