Skip to content

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

Closed

Description

@ranxianglei

来源: #4152 (#4152) 分析 PR CI 的 unused-exports 修复时发现
查重: 无(检索 open+closed issue/PR,无同失败签名的既有条目)

现象(同一时间窗内多次独立观测,受害测试轮换)

时间 (UTC 10-21) 代码头 run / job 失败测试 错误形态
~11:4x PR #4152 head 987a3ab run 39593321008 / job 119199725034 tests/issue760-percall-conversation.test.ts not ok 1944 + 1945 waitFor 'timeout waiting for initialize + tools/list responses',~5030ms
~12:1x 同上(rerun-failed-jobs 第 1 次) 同上 stream 1 / stream 2 tests/issue4079-egress-window-fuse.test.ts not ok 1912/1913;stream 2 另加 tests/storage-full-flip.test.ts not ok 3207(#3818 ⑨) cancelledByParent 'Promise resolution is still pending but the event loop has already resolved';AssertionError 'the safety valve lands a JSON envelope even under writerOff' duration 4919ms
12:25 master 5469a16(不含 PR 代码) run 39597779204 / job 119214420409 tests/storage-full-flip.test.ts not ok 1903(#3818 ⑥) AssertionError 'the disabling tick must land a JSON write — no window where the save exists on neither copy' duration 4858ms
~13:0x PR #4152 head 987a3ab(rerun 第 2 次) run 39593321008 / job 119231019875 stream 1 / stream 2 stream 1: tests/issue4079-egress-window-fuse.test.ts not ok 1912/1913;stream 2: 1912/1913 再犯 + not ok 1497(#2317 route-miss log)+ not ok 2457–2460(#2399/#2469 pi/omp lane adoption 全家) 同上 cancelledByParent;其余为同族时序断言

机制判断

受害者都是「严格时序断言」型测试:waitFor 固定预算(~5s)/ same-tick / safety-valve-window。windows-latest 共享 runner 负载升高时事件循环延迟超过断言窗口 → 超时或断言失败。受害者随运行轮换(非确定性),且 master 自身在同一时间窗红掉同样的 shard —— 排除任何单一 PR 回归:当时 git diff --stat <base>..origin/master -- tests/storage-full-flip.test.ts src/persist.ts src/server/update-actions.ts src/web/ 为空。

频率统计:4 个分片流里 #4079-egress-window-fuse(not ok 1912/1913)中 3 次,是最脆的一个;其次是 #3818 same-tick 变体、issue760 waitFor、#2317、#2399/#2469 adoption 族。

另注意 scripts/run-ci-tests.mjs 的自动重试只覆盖 #3029(swallowed death)与 #3665(fail-0 drain)两种可恢复形状;这类「具体断言失败」形状按设计不重试(防掩盖真回归)——所以这类 flake 会直接判红,需要人工 rerun。

影响

每次命中浪费一个 ~30min 的 CI 分片并阻塞对应 PR/master 合并;master 红风暴期间还会误导 triage(本次花了完整取证链才排除回归)。频率:2026-10-21 当天 3 小时内命中 4 个分片流(含 master 自身 1 次)。

建议方向(供 owner 拍板)

  1. 逐个加固受害测试:waitFor/时序窗口从固定 ~5s 提到更大固定值或自适应(优先 Context Window Overflow Issue Summary: Raw Requests Sent Directly to Upstream Rejected + Local Intercept Cooldown Lockin | 上下文超窗问题汇总:请求裸冲上游被拒 + 本地拦截冷却锁死会话(统一分析入口) #4079-egress-window-fuse,命中率最高;改 3–5 个测试文件;低风险但治标——下一个严格时序测试还会冒出来);
  2. 机制面:在 scripts/run-ci-tests.mjs 的 recoverable-shape 分类里加入 waitFor-timeout 形状与 Storage wrap-up: 6 fixes + switch default mode to full (single PR) | 存储收尾六修 + 缺省模式翻 full(一个 PR 统一处理) #3818 same-tick 断言形状,让它们走已有的有界整片重试(一次重跑即可过);
  3. 1+2 组合。

Activity

  1. ranxianglei commented on Oct 21, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

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

    #4160(本次红灯的自动实例,已按重复关闭到本 issue)取证补三个独立数据点:

    1. 同 shard 绿红对照:同一 run 里 ubuntu-latest, 22, 2(完全相同的测试集、相同序号 1903)ok,windows-latest, 22, 2 not ok —— 同代码同测试仅 Windows 红,平台特异性坐实。
    2. master 前一个 tick(run 39597602947,同一 commit)死法不同:fail 0(3715 pass / 2 cancelled),进程内 hang(Flaky Windows CI: issue1993-preflight-400 suite cancelled by early event-loop drain | Windows CI 偶发假红:preflight-400 测试进程提前退出致 5 例取消 #3665 drain 签名),同 runner 有界重试仍复现 → 那台 runner 本身不健康(日志里 spawn 的子进程 60s 绑不上端口)。同一时间窗内「零失败 hang」与「时序断言失败」并存,进一步支持环境因素判断。
    3. 排除 persist.ts 回归:断言对应的生产路径(src/persist.ts:2160-2161 附近,Storage Subsystem Wrap-up Checklist (#3130 Review): Dropping the last tick upon self-disable; BILI_PERSIST=0 falsely triggering a "Storage Degraded" banner; storageMode stamp mismatched with the actual enabled mode; and 3 more (6 items total) | 存储子系统收尾清单… #3135① disabled-mid-build → 立即落 JSON envelope)未动;今晨/昨晚上车的两个 persist.ts 改动(compress-from-store: evicted sessions compress against the unified-store view instead of refusing forever (#3918 P4 root fix) #3982、[Bug] MCP failed compression record rotation prematurely rewrites the history prefix, triggering expensive cache recompu | [Bug] MCP 失败压缩记录轮换提前改写历史前缀,触发大额缓存重算 #3769 flake fix)都在 load 路径,不在 save tick 路径。且该 fallback 的 warn 日志在失败 run 里确实打了——机制执行了,只是文件没在 400ms 断言窗口内可见。

    决策项我的倾向:选项 1,做成自适应轮询——受害测试从固定 sleep/waitFor 预算改成「轮询到满足为止 + 宽松 deadline」(绿时零额外开销,负载尖峰被 deadline 吸收),从源头消掉这类 flake;选项 2(把具体断言形状加进重试白名单)有掩盖风险——save 路径真回归长得和这个 flake 一模一样,脚本当初就是为这个不重试这类形状的;测试自身确定化之后重试需求自然消失。最终拍板在你。

  2. ranxianglei commented on Oct 22, 2026

    @ranxianglei
    OwnerAuthor

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

    新增证据行(#4152 分支 head d23b88b 的 CI,run 39818643648,job 119963987550 test (windows-latest, 22, 1),2026-10-22T17:14Z):同一分片出现新受害形态——Windows 文件锁 EBUSY(与既有「计时等待超时」同属环境性一族,症状相同:windows-latest 分片间歇红、受害者轮换):

    时间 运行 失败测试 错误签名
    10-22 17:14Z PR #4152 d23b88b not ok 3130 - storage engine: corrupt index.db degrades to legacy-only instead of bricking construction (#2771) EBUSY: resource busy or locked, unlink 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\bili-engproof-corrupt-*\\index.db'
    10-22 17:14Z 同上 not ok 3600 - #3040 corrupt index.db (guard #2771): degraded with the open-failure reason EBUSY: resource busy or locked, unlink '...\\bili-storage-banner-*\\sessions\\index.db'

    该分片 3895 测试仅这 2 个失败;两个都是临时目录里 SQLite 文件删除时撞上 Windows 文件锁(与 c0c0954/#3769 修过的「Windows EBUSY index.db close」同类)。与本 PR 改动无关(web UI + update-actions,不触碰存储引擎损坏处理路径)。

    建议方向补充一条:对这类 EBUSY-unlink 形态,可在 run-ci-tests.mjs 的 recoverable-shape 分类里加一条(错误串含 EBUSY + unlink + 临时路径),让它走既有的有界重试,而不是直接判死。

  3. ranxianglei commented on Oct 22, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

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

    查重:本条新增的 EBUSY 证据(windows-latest 22 分片 2 例 EBUSY … unlink … index.db)与 #4338 重复——同症状(corrupt-index.db 测试清理时删不掉临时库)、同机制族(存储引擎打开/写路径的持久句柄泄漏,不是 AV 瞬时锁),且 #4338 立项在先(17:14Z,比本条早 6 分钟)、机制分析更完整。按先来后到:保留 #4338,验证数据已补到该 issue 下,不另开新单。本 issue 的计时 flake 面(issue760 / #4079 / #3818)不受此判定影响,仍归本 issue。

    标签:bug + scope/ci + p2(间歇红、rerun 可绕行;EBUSY 面已转 #4338 跟踪)。

    对这条证据的独立核实(拉了 run 39818643648 / job 119963987550 全量日志):

    对建议方向(EBUSY+unlink+临时路径加入 recoverable-shape 重试白名单)的判断:建议暂缓,等根因钉死后再议。理由:

    1. 现有证据(Windows CI lane stuck red: corrupt-index.db tests cannot delete their temp dirs (EBUSY) — blocks every PR merge #4338 两次连续运行含 rerun 均红 + 本条第三次)显示该错误串当前是确定性复现(持久句柄泄漏)。加进有界重试救不了它——重试只会确定性地再失败一次,多烧一个 ~30 分钟分片才报同样的红;
    2. 这个错误串与一个正在跟踪的真实缺陷字节级相同,现在加白名单等于把对该缺陷的掩盖制度化(与一楼对选项 2 的担忧同源,在这里更强);
    3. 正确顺序:先按 Windows CI lane stuck red: corrupt-index.db tests cannot delete their temp dirs (EBUSY) — blocks every PR merge #4338 的方案钉根因(最小 Windows 复现 → driver.ts 打开失败路径显式释放/隔离,或损坏场景挪子进程 + 扩展 test(storage): close index.db handles before rmrf — fix Windows EBUSY in storage-engine-proofs (#2772 follow-up) #2781 rename 守卫到 closeQuietly 之后)。泄漏修好后这个形态应当整体消失;若届时仍残留真正瞬时的锁尾(test(windows): driveWire golden-harness 清理期 index.db EBUSY 复发(#2799 族,#2808 后残留) #2908 原始 AV 场景那种),再考虑进重试分类不迟。

    计时 flake 面(issue760 / #4079 / #3818):仍在等你在选项 1/2/3 里拍板,未动手。我的倾向同意一楼:选项 1(受害者测试自适应轮询加固)——不动重试分类器、不新增掩盖面;选项 2 与本条 EBUSY 白名单是同一个「掩盖风险」论证的实例。

    八问:

    1. 是什么问题:windows-latest node-22 分片间歇红,受害者在两族间轮换——计时断言超时/同刻断言,和 SQLite 临时库清理 EBUSY。
    2. 什么原因导致的:计时族 = runner 负载下固定轮询窗口不稳(环境性);EBUSY 族 = 存储引擎打开/写路径持久句柄泄漏(代码/上游层,Windows CI lane stuck red: corrupt-index.db tests cannot delete their temp dirs (EBUSY) — blocks every PR merge #4338)。同症状不同机制,分轨跟踪。
    3. 影响范围与严重程度:CI 合并门禁间歇受阻;计时族 rerun 通常可解,EBUSY 面目前 3/3 观测全红、rerun 无效,阶段性挡住所有合并(Windows CI lane stuck red: corrupt-index.db tests cannot delete their temp dirs (EBUSY) — blocks every PR merge #4338 跟踪,p2,是否升 p1 待你定)。无用户运行时影响。
    4. 怎么修复的:本轮未改代码——计时族等拍板(倾向选项 1),EBUSY 族走 Windows CI lane stuck red: corrupt-index.db tests cannot delete their temp dirs (EBUSY) — blocks every PR merge #4338 根因优先路线,重试白名单建议暂缓。
    5. 是否有回归问题:无(零代码改动)。
    6. 是否破坏缓存:不涉及。
    7. 是否改了设计方向:无。
    8. 是否引入新配置:无。

    收工判定:本轮完成查重、核实、打标;EBUSY 面并入 #4338(数据已补),计时面等你在 1/2/3 拍板后即开修。

  4. added a commit that references this issue on Oct 23, 2026
  5. added a commit that references this issue on Nov 9, 2026
  6. added a commit that references this issue on Nov 9, 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