chore(spec): DTS 堆上限 12288 → 8192(实测峰值 6.29 GB)—— ⚠️ 原「修 #4845」的前提已被本 PR 自己证伪 - #4853
Draft
os-zhuang wants to merge 1 commit into
Draft
chore(spec): DTS 堆上限 12288 → 8192(实测峰值 6.29 GB)—— ⚠️ 原「修 #4845」的前提已被本 PR 自己证伪#4853os-zhuang wants to merge 1 commit into
os-zhuang wants to merge 1 commit into
Conversation
`--max-old-space-size` 是允许 V8 涨到多少的上限,不是预留。设成 12288 时 V8 在逼近 12 GB 前都不积极 GC;而 `Test Core` 跑在 16 GB 的 ubuntu-latest 上, 叠加堆外内存与其它进程后越过物理内存,内核 OOM-killer 先于 V8 的 OOM 处理 把进程杀掉,因此没有任何 Node 侧输出 —— 日志里只有 `DTS Build start` 紧接 ` ELIFECYCLE Command failed.`。 实测(15 GB 机器,与 CI runner 同量级):8192 上限下 DTS 构建成功完成, 峰值 RSS 6.29 GB。8 GB 上限留约 27% 余量,并给 runner 剩约 8 GB 堆外与系统。 一个上午四次命中,横跨纯删除 / wire 形状迁移 / 纯文案 patch 三类无关改动, 第四次发生在合并队列里并把 PR 踢出 —— 命中取决于是否真跑 DTS(turbo 缓存 失效时),与改动内容无关。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176qgxgCXTJCUv4YFLtusP9
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-zhuang
marked this pull request as ready for review
August 3, 2026 10:14
os-zhuang
enabled auto-merge
August 3, 2026 10:14
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 106 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
disabled auto-merge
August 3, 2026 10:25
os-zhuang
marked this pull request as draft
August 3, 2026 10:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4845
一行数字改动 + 一段说明它为什么是这个数的注释。
问题
packages/spec的build脚本给 DTS 那一趟设了NODE_OPTIONS="--max-old-space-size=12288",而Test Core跑在runs-on: ubuntu-latest(公开仓 4 vCPU / 16 GB)。--max-old-space-size是允许 V8 涨到多少的上限,不是预留。设成 12 GB 意味着 V8 在逼近 12 GB 之前都不会激进 GC;叠加 tsup/tsc 的堆外内存、pnpm/turbo 进程与系统占用,总量越过 16 GB 物理内存时,内核 OOM-killer 先于 V8 自己的 OOM 处理把进程杀掉 —— 于是没有任何 Node 侧错误输出,日志里只剩:编译错误会打印诊断,V8 自己的堆耗尽会打印 heap OOM 堆栈 —— 两者都没有,就是被 SIGKILL 了。
这个数字不是防 OOM,而是 OOM 的成因之一。
实测(不是猜)
本机 15 GB / 可用 13 GB,与 CI runner 同量级。在 8192 上限下跑完整 DTS 构建,采样进程树 RSS:
副作用也是好的:万一将来类型图真的长到 8 GB 装不下,失败会变成 V8 的 heap OOM 堆栈(可诊断),而不是现在这种零输出被杀。
命中记录(#4845,一个上午四次)
第 3 例说明命中与改动内容无关(#4846 只改散文与注释,spec 类型图与之前逐字节等价);第 4 例说明它能实际阻止合并 —— 队列每次消化都是一次新抽签,重跑 PR 的 CI 帮不上忙。
之所以之前没暴露:
turbo对@objectstack/spec#build有缓存,只有改动 spec 的 PR 才真正跑这一趟。v17 窗口内 spec PR 密集,于是频率陡增。范围
packages/spec/package.json——build脚本里 DTS 那一趟的12288→8192,别的一字未动;packages/spec/tsup.config.ts—— 在既有的// Generate DTS separately to avoid memory issues下补一段说明「这是上限不是预留、设高于物理内存反而是成因」,免得下次有人看到 8192 觉得「不够大」又调回去;content/docs/releases/未触碰。后续
若 8192 仍不够(会以可诊断的 V8 heap OOM 形式出现,而非静默被杀),#4845 正文里还有两个方向:换更大的 runner、或按入口分批出 DTS。
🤖 Generated with Claude Code
https://claude.ai/code/session_0176qgxgCXTJCUv4YFLtusP9
Generated by Claude Code