You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Daemon can keep a dead writer lock, then run for hours with ready:false while every query times out #2918
On Windows 11 with the MCP lane serving CodeGraph 1.6.2, codegraph_explore began timing out on one
project while the CLI still reported a version and the project was indexed (12,451 files).
The .codegraph directory contained:
writer.pid -> {"pid":58188,"mode":"fallback","startedAt":...,"ready":false} (pid 58188: not running)
Clearing that and reconnecting left a second state:
The process was alive, had been up roughly 28 hours, and never reported ready:true. Every query against
that project timed out until the daemon was killed.
Why it is hard to recover from
The dead-pid case is recoverable (codegraph unlock, or deleting the stale artifacts).
The live but never-ready case is not: a pid-liveness check says "a writer owns this lock", so nothing
clears it, and the daemon keeps holding the project while answering nothing.
A client retry spawns another daemon against the same lock, which makes it worse.
Reproduction sketch
Start the daemon on a project, then kill it with SIGKILL-equivalent (taskkill /F) so writer.pid keeps
a dead pid.
Start a new daemon on the same project; observe it either wedge on the dead lock or come up with ready:false.
Query over MCP: the request times out rather than returning an error that names the lock.
We did not reproduce this from a clean upstream install in isolation; it was observed on a lane build of
1.6.2 that also carries unrelated local patches, so the exact trigger may differ. The lock handling and the ready flag are upstream behaviour.
What would fix it
Either of:
Write the pid only after the writer is ready, or add an ownership token with a heartbeat/TTL so a
stale record is distinguishable from a live writer.
Treat ready:false past a threshold as stale: clear the lock (and stop the owning daemon) when the
writer has not become ready for N minutes, and say so in the log.
At minimum, make the client failure name the lock file and the recorded pid instead of a bare timeout.
Environment
CodeGraph 1.6.2, Windows 11, MCP lane (npm-shim.js serve --mcp)
Project: a ~12k-file TypeScript monorepo
Recovery that worked: codegraph unlock, kill only the daemon process whose command line contains the
lane path, then one query
Tested upstream
CodeGraph 1.6.2, Windows 11, MCP lane, 2026-10-27; observed on a 12,451-file TS monorepo
I checked this against current main (b6379e6d). Two fixes merged after 1.6.2 look relevant, and neither is in a release yet:
fix(mcp): a daemon that never answers no longer stalls a new session for minutes #2795 (1040d09f): when another process held the daemon pipe but never sent hello, the launcher polled about 240 × 3 s (~12 min) while the session's tool calls were held. That fits "every query times out" while a live daemon owns the lock. The poll is now capped at 6 s, after which the session is served in-process, and the liveness watchdog replaces the stuck daemon.
On main, a writer.pid whose pid is dead is cleared and re-acquired by tryAcquireWriterLock, and codegraph unlock clears it by hand. A reader waiting for a live writer with ready:false gives up after 30 s (project-lifecycle.ts). A tool call waits at most 3 s on catch-up (CODEGRAPH_CATCHUP_GATE_TIMEOUT_MS), so ready:false by itself shouldn't block queries anymore.
Since this was seen on a patched 1.6.2 lane build, could you retest on current main or the next release? If a live writer still stays at ready:false indefinitely, look for a Catch-up sync failed for … line in that process's stderr. It would show why its startup sync never finishes.
Thanks for tracing those two changes and separating a live writer's readiness from lock ownership. I have recorded #2795 and #2819 as relevant upstream leads, not as a verified retest of the reported failure. There is no current-main or containing-release execution result from this watch, so I am not marking the original ready:false/query-timeout case fixed or the local guard redundant on that basis.
Activity
maxmilian commentedon Oct 27, 2026
I checked this against current
main(b6379e6d). Two fixes merged after 1.6.2 look relevant, and neither is in a release yet:1040d09f): when another process held the daemon pipe but never sent hello, the launcher polled about 240 × 3 s (~12 min) while the session's tool calls were held. That fits "every query times out" while a live daemon owns the lock. The poll is now capped at 6 s, after which the session is served in-process, and the liveness watchdog replaces the stuck daemon.3f58e343):codegraph indexno longer blocks on a daemon lock that names a process that isn't CodeGraph.On
main, awriter.pidwhose pid is dead is cleared and re-acquired bytryAcquireWriterLock, andcodegraph unlockclears it by hand. A reader waiting for a live writer withready:falsegives up after 30 s (project-lifecycle.ts). A tool call waits at most 3 s on catch-up (CODEGRAPH_CATCHUP_GATE_TIMEOUT_MS), soready:falseby itself shouldn't block queries anymore.Since this was seen on a patched 1.6.2 lane build, could you retest on current
mainor the next release? If a live writer still stays atready:falseindefinitely, look for aCatch-up sync failed for …line in that process's stderr. It would show why its startup sync never finishes.mradwankhalil commentedon Oct 28, 2026
Thanks for tracing those two changes and separating a live writer's readiness from lock ownership. I have recorded #2795 and #2819 as relevant upstream leads, not as a verified retest of the reported failure. There is no current-main or containing-release execution result from this watch, so I am not marking the original
ready:false/query-timeout case fixed or the local guard redundant on that basis.