Repository navigation
test(schedule-repair): 「prefers a late real receipt」先等 send 进入 dispatch 再推假时钟,修复高负载下 finishSend 未赋值 - #3299
Merged
Conversation
…ch 再推假时钟,修复高负载下 finishSend 未赋值 TurnSendLedger.execute 拿到记录的文件锁之后才调用 dispatch,拿锁花的是真实时间。 这条用例在 dispatch 里给 finishSend 赋值,却只靠推进假时钟就假定 dispatch 已被调用: 高负载下假时钟推完时 dispatch 还没进去,finishSend 仍是 undefined,报 TypeError。 失败后这次 fenced send 也没人释放,同一分片后面的「does not count a corrected failure again …」随之挂满 120 秒。 照同文件 slowFinal 的做法:先建好 deferred,dispatch 被调用时 resolve entered, 用例先 await entered 再推时钟;并把这次 send 登记进 pending,用例中途失败时由 afterEach 释放。 验证:在用例开头用 8 个 pbkdf2 占满 libuv 线程池后,修复前 5/5 红(TypeError), 同时跑 :653 那条也随之 120 秒超时;修复后 5/5 绿、两条一起跑都绿。隔离环境里加 CPU 负载、UV_THREADPOOL_SIZE=1 循环跑整个文件,修复后 10/10 绿。 Fixes #3276 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 10, 2026 07:12
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 c100770…8ec203230(5 个提交),同批合入的还有 #3308 #3324 #3306 #3301,失败不一定由本 PR 引起。
|
This was referenced Nov 11, 2026
|
🚀 Released in v3.59.2 |
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 #3276
改了什么
只改测试
test/schedule-repair-adversarial-review.test.ts里「prefers a late real receipt after an earlier settlement observed rejection」这一条用例,不动生产代码。为什么
TurnSendLedger.execute拿到记录的文件锁之后才调用传入的 dispatch,拿锁花的是真实时间。这条用例在 dispatch 里给finishSend赋值,却只靠推进假时钟(advanceTimersByTimeAsync(0)/(1_000))就假定 dispatch 已经被调用。高负载下假时钟推完时 dispatch 还没进去,finishSend仍是undefined,报TypeError: finishSend is not a function。失败后这次 fenced send 也没人释放,同一分片后面的「does not count a corrected failure again once its delivered receipt ages out of the send ledger」随之挂满 120 秒。issue 里列的两处失败是同一个原因。
修法与同文件的
slowFinal(#3238 加的)一致:entered;await entered,再推假时钟、再结算;pending,用例中途失败时由afterEach释放,不连累后面的用例。同文件其它
execute(...)调用的 dispatch 都直接返回或直接抛错,不给外部变量赋值,不受影响。验证
pbkdf2占满 libuv 线程池(拿锁的文件操作只能排在后面),修复前 5/5 红(TypeError: finishSend is not a function);同时跑 120 秒那条,它也随之超时。修复后 5/5 绿,两条一起跑也都绿。复现用的注入只在临时副本里,没有提交。UV_THREADPOOL_SIZE=1,循环跑整个文件:修复前 8 次红 1 次(与 CI 同样的报错),修复后 10/10 绿。bunx vitest run --project unit test/schedule-repair-adversarial-review.test.ts test/test-hygiene.test.ts→ 53 passed。这个文件用vi.hoisted,只在 vitest 腿跑。不发版、不部署。
🤖 Generated with Claude Code