Daemon can keep a dead writer lock, then run for hours with ready:false while every query times out
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #3041 来自 @johnhldiver-beep —— 已关闭,未合并
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 46/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start by tracing how the daemon creates and checks writer.pid, how it sets ready, and how MCP requests handle a writer that never becomes ready. Reproduce the dead-pid and live-but-not-ready cases on Windows using the issue’s steps, then inspect the relevant logs and tests. Done means stale locks are recoverable without spawning competing daemons, and clients receive a useful error identifying the lock and recorded pid.
由索引模型根据 Issue 内容生成。
描述
What happened
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:
writer.pid -> {"pid":20632,"mode":"fallback","startedAt":...,"ready":false} (pid 20632: running, ~28 h)
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) sowriter.pidkeeps
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:falsepast 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
- 主要语言
- C
- 星标
- 73.2k
- 派生
- 4.7k
- 平均合并
- 3 小时 31 分钟
- 30 天内合并 PR
- 546
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colbymchenry/codegraph 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
colbymchenry/codegraph#3093 ·
维护者通常 1 天内回复
-
Windows: npm-shim spawnSync missing windowsHide flashes a console window on every MCP server launch未关闭
难度 2/5 1-3 小时 新手友好度 86/100
colbymchenry/codegraph#3054 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
colbymchenry/codegraph#2974 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
colbymchenry/codegraph#2959 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
colbymchenry/codegraph#1900 · 2 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
查看 colbymchenry/codegraph 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
area:docs area:stdlib found-by:duet-audit kind:docs-drift
难度 2/5 1-3 小时 新手友好度 86/100
InauguralSystems/EigenScript#2251 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
flux-framework/flux-coral2#513 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
ly05010419/MacNativeGames#1420 ·
维护者通常 1 天内回复
-
Isaac working未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复