Skip to content

list_projects hangs indefinitely with 2 indexed projects (v0.9.0, macOS arm64, cli — single-project queries unaffected) #1195

Open

Description

@frankliu7

Environment

  • v0.9.0, darwin/arm64 (standard, non-UI variant), installed via install.sh
  • macOS on Apple silicon, 16 GB RAM
  • Invoked through cli only — the MCP server was never started, no watcher, no UI
  • Cache: ~/.cache/codebase-memory-mcp, 266 MB total

Summary

With exactly two indexed projects, list_projects blocks indefinitely and never returns. It has to be killed. Every other tool on the same cache keeps working normally, so this is specific to multi-project enumeration — not a corrupt cache and not a stuck database.

Repro

# 1. Index project A (private Python monorepo)
$ cbm cli index_repository --repo-path /path/to/A --mode full
{... "nodes":81527,"edges":301976,"status":"indexed"}          # 7.0 s

# 2. With ONE project in the cache, list_projects is instant
$ cbm cli list_projects
{"projects":[{"name":"...","nodes":81527,"edges":301976,"size_bytes":238682112}]}   # < 1 s

# 3. Index project B (a second, smaller repo)
$ cbm cli index_repository --repo-path /path/to/B --mode full
{... "nodes":14478,"edges":50848,"status":"indexed"}           # 1.3 s

# 4. With TWO projects, list_projects never returns
$ cbm cli list_projects
level=info msg=mem.init budget_mb=4096 total_ram_mb=16384
# ...hangs. Killed at 30 s, 180 s, and 335 s in three separate runs.

Reproduced 3/3 on a clean process table (all prior codebase-memory-mcp processes killed, no MCP server running).

Process state while hung

$ ps -eo pid,etime,%cpu,%mem,command | grep codebase-memory
 1563  05:35   0.0  0.0 codebase-memory-mcp cli list_projects
 2083  03:11   0.0  0.0 codebase-memory-mcp cli list_projects

0.0% CPU — blocked, not spinning. No log output beyond the mem.init line; ~/.cache/codebase-memory-mcp/logs/ stays empty.

Cache state (both DBs healthy)

40,501,248   <B>.db          32,768  <B>.db-shm          0  <B>.db-wal
238,682,112  <A>.db          32,768  <A>.db-shm          0  <A>.db-wal

Key discriminator — single-project access is unaffected

Immediately after killing the hung list_projects, both projects query fine:

$ cbm cli search_graph --project <A> --query "..." --limit 2     # rc=0, 44 ms
$ cbm cli search_graph --project <B> --query "..." --limit 2     # rc=0, 13 ms

So each database opens, reads and returns normally in isolation. Only the call that enumerates both hangs.

Impact

list_projects is the discovery entry point — the tool description for index_status explicitly tells callers to "Run list_projects to see indexed projects". Once a second project exists, an agent following that guidance blocks forever rather than getting an error, and there is no timeout or partial result to fall back on.

Relationship to existing issues (checked before filing; none appear to cover this)

Happy to gather anything further (sampled stack via sample, fs_usage, a CBM_CACHE_DIR-isolated two-project repro on public repos) if useful.

Activity

  1. added
    parsing/qualityGraph extraction bugs, false positives, missing edges
    stability/performanceServer crashes, OOM, hangs, high CPU/memory
    ux/behaviorDisplay bugs, docs, adoption UX
    windowsWindows-specific issues
    on Jul 21, 2026
  2. added
    bugSomething isn't working
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    and removed
    parsing/qualityGraph extraction bugs, false positives, missing edges
    windowsWindows-specific issues
    on Jul 22, 2026
  3. added this to the 0.9.1-rc milestone on Jul 22, 2026
  4. DeusData commented on Jul 22, 2026

    @DeusData
    Owner

    Thanks for the strong two-project isolation and process-state evidence. I removed the incorrect Windows/parsing labels and classified this as a high-priority 0.9.1-rc discovery hang under #593. The RED case will use two healthy stores in an isolated cache and require bounded completion; single-project query health must remain intact. No further reporter action is needed right now.

  5. xantorres commented on Jul 28, 2026

    @xantorres

    Reproduced on v0.9.0 / darwin-arm64 / macOS 25.5.0, CLI only — MCP server never started, no watcher, no UI, auto_index and auto_watch both false.

    The "exactly two projects" framing does not hold on my machine. The hang is state-dependent, not count-dependent. Observed sequence, each list_projects run redirected to a fresh file:

    Projects indexed Result
    4 OK, sub-second
    1 (immediately after 5 rapid delete_project calls) hang, killed at 120 s
    1 hang, killed at 25 s
    1 OK
    2 hang ×8 consecutive, killed at 15 s each
    1, 2, 3 OK, 0.02–0.54 s

    So it hung at 1 and at 2, and was fine at 1, 2, 3, and 4. It entered a bad state, stayed there across ~10 consecutive invocations, then cleared after further index/delete operations.

    Additional data points:

    • Killable with SIGKILL — I never saw the uninterruptible UE state reported elsewhere.
    • No lock file, no daemon process, and no live codebase-memory-mcp processes between runs. All *.db-wal files were 0 bytes.
    • index_status --project <name> never hung, including during the 8-consecutive-hang window. It looks like a viable workaround.

    Methodology warning for anyone else measuring this: my first attempt reported 0/6 hangs and was wrong. Under zsh with noclobber set, > out.json fails for runs 2..n and the reader silently re-reads run 1's output. Use a unique output file per run, or you will measure a hang as a pass.

  6. DeusData commented on Jul 28, 2026

    @DeusData
    Owner

    Thanks for the careful rerun and for correcting the shell redirection pitfall.

    The new data disproves “exactly two projects” as the trigger. Current main's list_projects path is distinct from index_status: it scans every cache DB and opens each one to read its internal project identity (src/mcp/mcp.c:2081-2124), while a single-project query resolves one store. That matches the fact that index_status stayed healthy during the bad state, but static code does not yet identify which DB/open state causes the intermittent hang.

    Keeping this priority/high in 0.9.1-rc with the corrected state-dependent scope. No awaiting-reporter label is appropriate; the new measurements already move the investigation forward. Thank you.

  7. DeusData commented on Aug 14, 2026

    @DeusData
    Owner

    @frankliu7 — the discriminator you built into the report is what kept this from being written off as a corrupt cache: both databases open and query fine in isolation, only the call that enumerates both hangs, and at 0.0% CPU so it is blocked rather than spinning.

    @xantorres then disproved the "exactly two projects" framing with a state-dependent table, and warned everyone about the noclobber redirection trap that had made his own first measurement read as a pass — a correction very few people would have gone back and published.

    Where we honestly stand: list_projects scans every cache database and opens each one to read its project identity, unlike the single-project path that stays healthy throughout, but reading the code has not yet identified which open state wedges. Nothing is waiting on either of you. Tonight's v0.10.5 targets the issues that make cbm impossible to operate, and a core tool that hangs until it is killed is one of them.

  8. DeusData commented on Sep 26, 2026

    @DeusData
    Owner

    Thank you, @frankliu7 and @xantorres! The state-dependent table and the noclobber warning were especially useful. On current main, where CLI commands go through the shared daemon, we couldn't reproduce a hang in 20 runs, including right after rapid deletes. Could either of you check v0.11.0? If it wedges, a sample <pid> of the stuck process would pin down the open state.

  9. added
    awaiting-reporterWaiting on the reporter for info/repro; stale bot will warn then close
    on Sep 26, 2026
  10. xantorres commented on Sep 26, 2026

    @xantorres

    Thanks for the follow-up. I've since stopped using codebase-memory-mcp, so I can't retest on v0.11.0. Fine to close from my side if @frankliu7 can't reproduce either.

  11. github-actions commented on Sep 27, 2026

    @github-actions

    Thanks for the report! To move this forward we need a bit more so we can reproduce it ourselves:

    • the codebase-memory-mcp --version you're on
    • the exact steps or command you ran
    • a public repo (or a small dummy snippet) that shows the problem — please don't paste proprietary code

    Once that's here we'll pick it straight back up. Heads-up: issues left awaiting-reporter are automatically closed after a few weeks of silence, but a comment reopens the door anytime.

  12. DeusData commented on Oct 19, 2026

    @DeusData
    Owner

    Thank you both for the careful state-dependent measurements, and @xantorres for letting us know you cannot retest. No further work is expected from you. @frankliu7, if you still use cbm, confirmation on v0.11.0 or newer remains helpful; the earlier successful runs do not by themselves prove the intermittent hang resolved.

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

    awaiting-reporterWaiting on the reporter for info/repro; stale bot will warn then closebugSomething isn't workingpriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions