Flaky: concurrent_hard_miss_errors_are_returned_to_each_caller can count two loader calls

未关闭 适合新手
#1,072 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
79/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
testing

调研方向

从 crates/cache/src/tests.rs 开始,重点查看 concurrent_hard_miss_errors_are_returned_to_each_caller 及其运行时配置。检查暂停的时间和已启动的任务如何与 loader 的休眠交互。调整测试,使八个调用方都在 loader 完成前到达正在处理的条目,然后确认测试仍会验证 loader 只调用一次,并且每个调用方都收到错误。

由索引模型根据 Issue 内容生成。

描述

crates/cache/src/tests.rs, concurrent_hard_miss_errors_are_returned_to_each_caller, failed in the mongodb-rust job of PR #970, a change to one docs file (job 133779105987, 17 November 02:55 UTC):

thread 'tests::concurrent_hard_miss_errors_are_returned_to_each_caller' panicked at crates/cache/src/tests.rs:850:5:
assertion `left == right` failed: 8 concurrent hard-miss callers must collapse to exactly one loader call
  left: 2
 right: 1

The test spawns 8 tasks that each call cache.get("k"). The loader sleeps 30 ms and returns an error, and errors are not cached. A task that first runs after the first loader call ended finds no single-flight entry and starts a second call. On a loaded runner a spawned task can start more than 30 ms late, so the count of 2 needs no defect in the cache.

Fix: the test runs on a multi-thread runtime (flavor = "multi_thread", worker_threads = 4). On a current-thread runtime with start_paused = true, the clock advances only when every task waits, so all 8 calls reach the in-flight entry before the loader's sleep ends. If the test must keep the multi-thread runtime, a loader sleep far above a runner's scheduling delay makes the second call unlikely, not impossible.

主要语言
Rust
星标
517
派生
60
平均合并
5 天 14 小时
30 天内合并 PR
124

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ExtendDB/extenddb 的其他 Issue

查看 ExtendDB/extenddb 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。