Skip to content

Flaky test: WAL custom-cap checkpoint case asserts byte-exact file size, intermittently red on 5 CI shards #4489

Closed

Description

@ranxianglei

来源: PR #4485 (#4485) 分析 merge-coverage-regression 根因修复时发现(为该 PR 的 CI 验证过程中定位到)。查重: 无(open+closed issue 与近期 PR 按 WAL/journal_size_limit/checkpoint/media-cas 失败签名检索,无匹配)。

Scope update(review 后续取证)

立项时只覆盖 WAL 一例;对全部红 shard 日志的取证发现兄弟 shard 上还有第二个测试在红——同一失败家族(unified-storage 回收类断言、node:sqlite/builtin 引擎、固定 shard 槽位、跨 run 阵发式)。按「同一症状一个 issue」政策,两个子缺陷都在本 issue 管理。建议更宽标题(标题改名归同步层/owner):"CI flake family: unified-storage reclamation tests (WAL custom-cap + media CAS stale-row sweep) intermittently red in fixed shard slots"。

子缺陷 A:WAL custom-cap(原始报告)

子缺陷 B:media CAS stale-row sweep

  • tests/media-cas.test.ts — "media CAS: stale-row sweep releases media refs and mappings (full re-ingest drops the image)"
  • AssertionError: swept message released its media ref(期望 0,实际 1)——sweep 后 media ref 计数应归零未归零。失败 duration ~17ms → 状态断言,非超时。
  • 出现于含该文件的 shard 槽位(观测:ubuntu 24/3、ubuntu 22/3、windows 22/2)。

既有问题且环境依赖的证据(跨树相同失败图谱)

master run 40068050438(sha 02f544d,不含任何 PR 变更)在完全相同的 shard 槽位以逐字节相同的签名失败;PR #4485 head c4d1b22 的三次 attempt 同样。逐槽位签名核对覆盖全部 5 个槽位(attempt 1 核 4 槽 + attempt 2 核余下 1 槽):

shard 槽位 master 40068050438 PR head c4d1b22
ubuntu 24/1 WAL(test #1275) WAL ×3
ubuntu 22/1 WAL(#1275) WAL ×3
ubuntu 24/3 media-CAS(#1243) media-CAS ×3
ubuntu 22/3 media-CAS(#1243) media-CAS ×3
windows 22/2 两者(#635+#835) 两者 ×3

测试序号跨树一致(1275/1243/635/835)⇒ 每 shard 文件组成相同(host CI 只对顶层 tests/*.test.ts 分片,scripts/run-ci-tests.mjs:105 非递归 readdir + 确定性 LPT 分片;PR 新增测试在 kernel/tests/ 不进入该清单)。同 sha 的后续 master runs(05:55Z×2、06:27Z)全绿 ⇒ runner/池依赖,非代码依赖。

机制候选(未验证)

  • A:journal_size_limit 截断残留 vs 单页容差——截断是页粒度且在 checkpoint 完成边界应用,残留量随环境漂移。
  • B:sweep 的完成顺序或时钟窗口敏感性(单次观察点断言回收已完成)。
  • 共同点:两个测试都断言「回收已完成」的单次观察结果,都跑在 node:sqlite/builtin 上;不排除更深的共同环境因子(runner FS/SQLite 行为)。

影响

阵发性红 CI(今日观测窗口 05:53–07:30 UTC):合并阻塞噪音、浪费舰队算力(本 PR 已消耗 3 轮 × 5 shard 重试)。无用户可见行为变化。

修复建议

Activity

  1. ranxianglei commented on Oct 24, 2026

    @ranxianglei
    OwnerAuthor

    (ai: vllm-qwen/qwen3.8-27b)

    Refined evidence (from the PR #4485 review follow-up):

    1. Independence from any PR diff is now proven, not just evidenced. The host CI shards ONLY top-level tests/*.test.ts (readdirSync(testsDir), non-recursive, scripts/run-ci-tests.mjs:105); PR [PR] kernel: preserve existing block coverage when merging blocks (#4484) #4485's new test lives under kernel/tests/ (kernel suite lane), so the sharded file list is byte-identical between master and that head → identical LPT partition → the 5 failing shards contain exactly the same files in both trees. Same error bytes across trees ⇒ purely runner-dependent.
    2. Attempt 2 of run 40069753327 failed again (same 5 shards, same test, same left 1095952 bytes), engine logged as node:sqlite/builtin. Two consecutive red attempts on one head vs one red + two green on master: unlucky-draw hypothesis still fits, but this shape clearly needs the house treatment.
    3. House mechanism exists for exactly this class: scripts/run-ci-tests.mjs + scripts/ci-failure-shapes.mjs classify recoverable strict-timing shapes under runner load and retry the shard once (CI flake:test (windows-latest, 24) 单文件文件级失败:子测试零执行、异常被吞为 'test failed' #3029 drain family, CI: windows-latest node-22 shard 2 intermittently red on timing-sensitive e2e tests under load (rotating flakes: issue760, #4079, storage-full-flip #3818) #4161 timing-budget family, windows-22-1 lane randomly red: during test cleanup, unlink index.db hit an EBUSY external lock, couldn't survive tmp-rm | windows-22-1 车道随机红:测试清理期 unlink index.db 遇 EBUSY 外部锁,熬不过 tmp-rm 的 9.6 秒重试梯子(#2799/#2908 族复发) #4347 transient-lock family — each with the "deterministic break reproduces on retry" guard). This WAL custom-cap signature is NOT in the classifier, so it goes straight red. Suggested fix therefore has two parts, mirroring CI: windows-latest node-22 shard 2 intermittently red on timing-sensitive e2e tests under load (rotating flakes: issue760, #4079, storage-full-flip #3818) #4161's belt-and-suspenders: (a) make the assertion convergence-driven (bounded extra ingests until walSize <= cap + CAP_SLACK) so the exact-timing assumption goes away at the source; (b) optionally add the signature to ci-failure-shapes.mjs as defense-in-depth until (a) ships.
  2. ranxianglei commented on Oct 24, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    查重: 不重复——按 WAL / journal_size_limit / checkpoint / flaky 失败签名检索 open+closed issue 与近期 PR,无匹配(OP 已声明「查重: 无」,我独立复核确认)。

    标签: bug + scope/ci + p3(CI 抖动噪音类缺陷,无用户可见影响;无客户端涉及)。

    修复已完成 → PR #4502(Closes #4489)。本地先复现后验证:修前本地跑出与 CI 字节一致的报错(left 1095952 bytes),修后连续 10/10 通过,typecheck 干净。

    八问:

    1. 是什么问题:[bug] index.db-wal 在长驻进程内永不 checkpoint —— STORAGE_PRAGMAS 无 journal_size_limit、master 无 wal_checkpoint 调用,WAL 单调增长到 55 MiB 不回收 #3250 的 custom-cap 回归测试在「固定 ingest 次数」后断言 WAL 文件必须 ≤ cap+1 页。但文件在 cap 之上的残留量取决于 1000 页 autocheckpoint 窗口恰好落在哪个 commit 边界上——这由各 runner 自带 SQLite 构建的页打包差异决定,所以某些机器稳定红、另一些稳定绿,same sha,错误字节完全相同。
    2. 什么原因导致的:WAL 文件是锯齿波——每个 commit 增长 → 每次 checkpoint 完成时精确落回 cap → 再增长(autocheckpoint 在累计超 1000 页后的下一个 commit 触发;每 20 次 ingest 的 PASSIVE tick 也会落回)。固定计数断言只是在这个周期过程上采样了某一个相位,采到谷还是采到回升段由环境决定。这是测试自身的 hermeticity 缺口,不是 src/storage 回归——同文件默认 8 MiB cap 的兄弟用例在同一红色 shard 里全绿,回收机制本身工作正常。
    3. 影响范围与严重程度:无任何用户/生产行为影响;影响面 = 无关变更的 CI shard(master push / 其他 PR)间歇红,造成 merge-blocking 噪音和重跑算力浪费。严重度 p3(CI 噪音类)。
    4. 怎么修复的:断言从「定点采样」改为「收敛驱动」——继续提交 128 KiB 单元,直到某次完成的 checkpoint 把文件带回 ≤ cap+slack,上界 CONV_UNITS = 24(一个完整 cadence 周期 20 + 落地滞后 1 + 余量 3,推导写在常量注释里)。关键实测约束:单写者下两类 completed checkpoint 都会把文件精确落回 cap;autocheckpoint 触发点在越过 1000 页的那个 commit 的下一个;更大的单元(1 MiB)不可用——它自己的 extent(~1.15 MiB)截断后仍超 cap+slack,所以循环必须用 128 KiB 单元。未加 ci-failure-shapes.mjs 分类器签名(上条评论的可选 part b):本 PR 已消除源头,再加就是死代码,且该分类器是字面窄匹配纪律;若合入后签名再现,再作为纵深防御补上。
    5. 是否有回归问题:无。test-only diff(单文件 tests/issue3250-wal-checkpoint.test.ts,+37/−10),src/ 零改动。RED/GREEN 判别力保持:对照实验(limit 设为 100 MiB ⇒ truncate 变 no-op,等价 pre-fix 世界)显示文件全程钉在高水位不收缩 → pre-fix 树在新断言下照样红。
    6. 是否破坏缓存:不涉及(未触碰任何缓存/重试/游标/去重逻辑)。
    7. 是否改了设计方向:不涉及架构/数据流;测试断言模式从定点采样改为有界收敛轮询,与 CI: windows-latest node-22 shard 2 intermittently red on timing-sensitive e2e tests under load (rotating flakes: issue760, #4079, storage-full-flip #3818) #4161 的 house 模式同构。
    8. 是否引入了新的配置:不涉及(无 env/config;CONV_UNITS 是测试文件内局部常量)。

    判定:可合并——待 PR #4502 远程 CI 全绿即收工,无阻塞项。

  3. ranxianglei commented on Oct 24, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    来源: #4497 分析 CI 红时发现。review PR #4497(durable-mnemon 分类器,与存储域零交集)时对两轮 CI 红做了逐分片日志取证,发现同一失败域还有两条本 issue 范围外的 flaky 签名。按「同失败域 = 同 issue」并入此处管理,不另立项。

    新增 flaky 签名(检查清单补充)

    交叉证据(与本 OP 互证)

    对收敛判定的影响

    PR #4502 覆盖 WAL custom-cap 一条。按本轮观察频率,media CAS stale-row sweep 出现次数与 WAL 相当(两 run 合计 6 vs 5),#1365 attach-mode 较低(1 次)。#4502 合入后这两条大概率仍会红分片——建议后续在本 issue 内按同一「收敛驱动断言」思路跟进这两项(或各自独立修复,机制不同不强行合并修法)。

  4. added 2 commits that reference this issue on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions