Skip to content

Commit dabb3fd

Browse files
committed
fix(ci): spec 的 DTS 堆上限 12288 → 8192 —— 上限高于物理内存反而促成 OOM (#4845)
`--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
1 parent 799d098 commit dabb3fd

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
---
3+
4+
chore(spec): 把 DTS 构建的堆上限从 12288 降到 8192(#4845)
5+
6+
发布面零变化 —— 改的是 `packages/spec``build` 脚本里 DTS 那一趟的
7+
`--max-old-space-size`,不影响任何产物内容,故为空 changeset。
8+
9+
`--max-old-space-size`**允许 V8 涨到多少的上限,不是预留**。设成 12288 时,
10+
V8 在逼近 12 GB 之前都不积极 GC;而 `Test Core` 跑在 16 GB 的 `ubuntu-latest`
11+
上,叠加堆外内存与其它进程后总量越过物理内存,**内核 OOM-killer 先于 V8 的
12+
OOM 处理把进程杀掉,于是没有任何 Node 侧错误输出** —— 日志里只看到
13+
`DTS Build start` 紧接着 ` ELIFECYCLE Command failed.`
14+
15+
也就是说这个数字不是防 OOM,而是 OOM 的成因之一。
16+
17+
实测(15 GB / 可用 13 GB 的机器,与 CI runner 同量级):DTS 构建在 8192 上限下
18+
**成功完成,峰值 RSS 6.29 GB**。8 GB 上限相对真实需求留约 27% 余量,同时给
19+
runner 剩下约 8 GB 供堆外与系统使用。
20+
21+
一个上午内四次命中,横跨内容毫不相干的 PR(纯删除 / wire 形状迁移 / 纯文案
22+
patch),第四次发生在**合并队列**里并把 PR 踢了出来 —— 说明命中取决于是否真的
23+
跑这一趟 DTS(turbo 缓存失效时),与改动内容无关。

packages/spec/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
"spec-changes.json"
183183
],
184184
"scripts": {
185-
"build": "pnpm gen:schema && pnpm gen:openapi && tsup && if [ -z \"$OS_SKIP_DTS\" ]; then NODE_OPTIONS=\"--max-old-space-size=12288\" BUILD_DTS=true tsup; fi",
185+
"build": "pnpm gen:schema && pnpm gen:openapi && tsup && if [ -z \"$OS_SKIP_DTS\" ]; then NODE_OPTIONS=\"--max-old-space-size=8192\" BUILD_DTS=true tsup; fi",
186186
"dev": "tsc --watch",
187187
"clean": "rm -rf dist",
188188
"gen:schema": "OS_EAGER_SCHEMAS=1 tsx scripts/build-schemas.ts",

packages/spec/tsup.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ const entries = [
2121
'src/shared/index.ts'
2222
];
2323

24-
// Generate DTS separately to avoid memory issues
24+
// Generate DTS separately to avoid memory issues.
25+
//
26+
// [#4845] The DTS pass runs under an explicit `--max-old-space-size` (see the
27+
// `build` script in package.json). That number is a CEILING V8 is allowed to
28+
// grow to, NOT a reservation — set it above what the machine can actually give
29+
// and V8 simply stops collecting aggressively, grows past physical memory, and
30+
// the kernel OOM-killer takes the process with NO diagnostic output at all
31+
// (`DTS Build start` followed straight by `ELIFECYCLE`). It was 12288 on a
32+
// 16 GB `ubuntu-latest` runner, which is that failure, not a guard against it:
33+
// four CI hits in one morning across PRs that shared no content — including one
34+
// pure-prose patch — and the fourth ejected a PR from the merge queue.
35+
// Keep this comfortably under the runner's physical memory.
2536
const isDts = process.env.BUILD_DTS === 'true';
2637

2738
export default defineConfig({

0 commit comments

Comments
 (0)