Skip to content

test(schedule-repair): 两个长窗口 pumpUntil 用例在高负载 shard 上墙钟超时 flake #3232

Closed

Description

@deepcoldy

现象

test/schedule-repair-adversarial-review.test.ts 在用例 accounts a send that outlives the in-flight wait as unknown and lets its late receipt correct it(:524,断言在 :536)和 does not count a corrected failure again once its delivered receipt ages out of the send ledger(断言在 :636)上间歇失败,报错形如:

AssertionError: expected { Object (id, name, ...) } to match object { lastStatus: 'error', …(2) }
 ❯ pumpUntil test/schedule-repair-adversarial-review.test.ts:64:3

两次实测记录(不同 PR、同一晚高峰窗口,失败签名逐字相同:1 failed | 638 passed | 4 skipped):

同样的两个用例在负载低的 run 里通过(如同晚 master push run 42533899055 的 shard 4/4);本地定向跑该文件 25/25 全绿。

机理

两个用例都把假时钟推进 SCHEDULED_SEND_IN_FLIGHT_LIMIT_MS + 60_000(10 分钟 + 1 分钟模拟时间),pumpUntil 默认每步 1000ms,即约 660 次 vi.advanceTimersByTimeAsync,每次都向真实事件循环让出 microtask。shard 宿主高负载时,真实调度延迟累积,文件墙钟逼近并用例自身的 120_000 ms 超时(两次失败分别跑了 121.3s / 122.1s),vitest 在 pump 途中杀掉用例,最后的 check() 抛断言失败。生产代码路径没有被证伪——假时钟窗口根本没泵完。

建议修法(测试-only)

  • 把这两个用例的墙钟 timeout(:546、:659 的 120_000)放宽到 240_000,或
  • 长窗口 pump 改用更粗步进(如 5_000ms),把异步轮次从约 660 降到约 132,缩短墙钟占用;保留现有注释里「one-shot advance stalls on load」的分步泵语义。

修合入后,被挡的 PR 同步 master、在新 head 拿首跑全绿再合(G4:真实测试步骤的偶发失败不靠同 SHA 重跑放行)。

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions