CLI: an indexer killed by a signal (out of memory) exits 1 with no message
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript, wasm
调研方向
从 src/extraction/wasm-runtime-flags.ts 开始,重点查看 relaunchWithWasmRuntimeFlagsIfNeeded,并检查 spawnSync 的结果如何决定 CLI 退出状态。使用 issue 中限制内存的命令复现子进程被信号终止的情况,然后检查此重新启动路径的现有测试。当被信号终止的子进程产生一条 stderr 消息,指出信号名称和预期的 shell 风格退出代码时,即为完成。
由索引模型根据 Issue 内容生成。
描述
What happens
When the indexer that the CLI relaunches with the WASM runtime flags is killed by a signal, the codegraph command exits 1 and prints nothing. An out-of-memory kill during codegraph init or codegraph index then looks like an ordinary failure with no message, and the exit code doesn't say a signal was involved.
relaunchWithWasmRuntimeFlagsIfNeeded drops result.signal:
const result = spawnSync(process.execPath, argv, { stdio: 'inherit', ... });
if (result.error) { return; }
process.exit(result.status ?? (result.signal ? 1 : 0));
Repro (main f72c9d2e, Node 22.22.2, Linux x64 on WSL2, CODEGRAPH_KERNEL=0)
Any repo works if memory is capped low enough. With honojs/hono at f6fbaf0 and a 400 MB cgroup cap, where the kernel kills only the largest process:
systemd-run --user --scope -q -p MemoryMax=400M -p MemorySwapMax=0 -p OOMPolicy=continue \
node --trace-exit dist/bin/codegraph.js init -i .
echo "exit=$?"
Scanning files...
Parsing code...
(node) WARNING: Exited the environment with code 1
at exit (node:internal/process/per_thread:245:13)
at relaunchWithWasmRuntimeFlagsIfNeeded (dist/extraction/wasm-runtime-flags.js:41:13)
at dist/bin/codegraph.js:100:63
exit=1
Kernel log for the same run: Memory cgroup out of memory: Killed process … (node) … anon-rss:375764kB. Without --trace-exit, nothing is printed after Parsing code....
Control: the same command with CODEGRAPH_NO_RELAUNCH=1 exits 137, and the shell reports Killed.
The same thing happens without an artificial cap. Indexing microsoft/vscode at ca43fc94 under a 6 GiB limit exits 1 silently after Resolving refs... (child at 5.8 GB RSS when killed). Effect-TS/effect 7a87ff9 exited 1 the same way after Resolving refs... while several indexers shared one machine's memory, with cgroup OOM kills in the kernel log at that time.
Expected
- Report the signal on stderr, e.g.
codegraph: the indexer was killed by SIGKILL (out of memory?). - Exit with 128 + the signal number (137 for
SIGKILL), as a shell would, so scripts and CI can tell a kill from a failure.
Related but different: #3137 is the MCP worker's watchdog respawn loop under memory exhaustion. This one is the one-shot CLI's exit path.
- 主要语言
- C
- 星标
- 73.2k
- 派生
- 4.7k
- 平均合并
- 3 小时 11 分钟
- 30 天内合并 PR
- 416
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colbymchenry/codegraph 的其他 Issue
-
Separate Installation Commands into Individual Code Blocks可能已有人在做 @andrySD 于 7 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
colbymchenry/codegraph#3241 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
colbymchenry/codegraph#3228 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
colbymchenry/codegraph#3223 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
A `../` entry in package.json `workspaces` makes a folder outside the project count as a workspace package, and a call gets linked to the wrong function可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 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 天内回复
查看 colbymchenry/codegraph 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
FujiNetWIFI/fujinet-config#379 ·
维护者通常 1 天内回复
-
Ship /Local/Applications, the Local domain's Applications folder可能已有人在做 @pkgdemon 今天认领。 未关闭area:base enhancement
难度 1/5 1 小时以内 新手友好度 94/100
nextbsd/nextbsd-userland#612 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
zephyrproject-rtos/zephyr#125543 ·
维护者通常 2 天内回复
-
good first issue needs-triage
难度 1/5 1 小时以内 新手友好度 88/100
InauguralSystems/EigenScript#2347 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100