Skip to content

Startup index: single-threaded full re-parse after commit blows up memory (~+5 GB at a fixed point), daemon exits silently; with .memtraceignore present it also holds the derived-store lease and blocks all queries #118

Open

Description

@hrabbach

Environment

  • memtrace 1.2.15 (npm global, @memtrace/win32-x64), Node v26.13.0
  • Windows 11 Pro 10.0.26300, AMD Ryzen 7 250 (16 logical cores), 31 GB RAM
  • Local MemDB mode, owner started as memtrace start --headless; host profile tier Standard, CPU EP
  • Repo: one git repo, 7,392 tracked files (mostly .md, .js, .kt); memtrace scans 6,869 files
  • No MEMTRACE_* environment variables set (reproduced after a full clean reinstall: npm package, ~/.memtrace, all .memdb/.memtrace stores removed)

Summary

The first index completes correctly (116,225 nodes / 395,496 edges, index_state: current). Immediately afterwards a second parse of the whole repository runs on one thread, persists nothing, and accumulates memory. At a fixed point in that second pass (parse account = 13,380 files, i.e. ~file 6,511 of 6,869 in the second pass) RSS jumps by ~5 GB within one minute, and the owner process exits silently a minute later at ~7 GB (below the 8,006 MB sustained guard). Nothing restarts the owner; MCP children then fail with MemDB endpoint is unreachable.

Separately, when the repo has a .memtraceignore, the post-index ignore-scope convergence never completes and holds the derived-store lease for the whole re-parse, so every store-touching tool fails with:

current ignore scope could not be reconciled: memtraceignore reconciliation could not acquire derived-store lease

Reproduction

Reproduced 3 times on a clean store (twice with .memtraceignore, once without). The .memtraceignore is 13 lines of ordinary excludes:

android/**/build/
android/build/
android/app/build/
android/.gradle/
android/**/.cxx/
**/node_modules/
  1. Delete the repo's .memdb / .memtrace.
  2. memtrace start --headless in the repo root (or let an MCP client start the owner).
  3. Watch the owner process and mem_diag → cpu.since_start.accounts.

Observed timeline (run without .memtraceignore, start 19:36:49 local)

Time CPU/min RSS Store Busy threads Notes
+0.5 min — 2.1 GB 2 MB 8 parse, multi-threaded
+2.5–3.5 min +60 s 4.5–4.7 GB 2 MB 1 resolve (single thread)
+4.5–6.5 min +3–24 s 3.4–3.6 GB 0.8→1.6 GB 0 persist
+8.5 min +69 s 377 MB 1.7 GB 1 convergence 1/1, queries work; parse = 10,011 (> 6,869 scanned)
+9.5 min +61 s 1.39 GB 1.7 GB 1 parse = 12,313
+12.5 min +60 s 1.98 GB 1.76 GB 1 still re-parsing, ~+100 MB/min
+13.5 min +60 s 7.09 GB 1.76 GB 1 parse = 13,380, memory: warn, decision.reason: memory
+14.5 min — — — — owner exits (no Windows event-log entry, nothing in .memdb/memcore-server.log)

mem_diag at the spike (both runs identical in shape):

parse 603.0s/13380 files · resolve 102.9s/6 passes · convergence 6.3s/1 repos · finish 4.0s/6 stages · scan 0.6s/6869 files · embed 0.2s/0 vectors · persist 0 records
own_cores ≈ 1.0, rss_mb 7088, sustained_guard_mb 8006

The run with .memtraceignore shows the same parse count (13,380) at its spike (6.4 GB, then ~7 GB and exit), plus convergence 0/1 repos after 2 attempts, embed 0 vectors, and the lease error above on find_symbol / find_code / get_repository_stats from the moment the graph committed until the owner died. In that run list_indexed_repositories also switched path/repo_path from \\?\C:\<repo-root> to null after the commit.

Expected

  • No second full parse after a successful commit (or, if one is needed for scope reconciliation, multi-threaded, bounded, and reusing the committed graph).
  • Ignore-scope convergence must not hold the derived-store lease across a long-running operation, and must not block read tools.
  • An owner exit caused by memory (or anything else) should be logged, and the MCP side should restart or clearly surface it.

Notes

  • The memory spike happens at exactly the same parse count in every run, so a specific file late in the second pass is the likely trigger. The first pass handles the same files without trouble. I have not bisected it yet and can do so if a one-file reproduction would help.
  • Embeddings never start in any run, because the owner dies before reaching them.

Activity

  1. blocksorg commented on Nov 3, 2026

    @blocksorg

    Mention Blocks like a regular teammate with your question or request:

    @blocks can you add technical details to this issue?
    @blocks make the following changes ...
    @blocks create an issue from what was mentioned in the following comment ...
    @blocks explain the following code ...
    @blocks are there any security or performance concerns?

    Run @blocks /help for more information.

    Workspace settings | Disable this message

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

Metadata

Metadata

Assignees

No one assigned

    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