Flaky: concurrent_hard_miss_errors_are_returned_to_each_caller can count two loader calls

Đang mở Phù hợp với người mới
#1,072 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
79/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu với crates/cache/src/tests.rs, đặc biệt là concurrent_hard_miss_errors_are_returned_to_each_caller và cấu hình runtime của nó. Kiểm tra cách thời gian tạm dừng và các task đã khởi chạy tương tác với khoảng nghỉ của loader. Điều chỉnh bài kiểm thử để cả tám caller đều tới được mục đang xử lý trước khi loader hoàn tất, rồi xác nhận rằng bài kiểm thử vẫn xác minh chỉ có một lần gọi loader và mọi caller đều nhận được lỗi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
517
Fork
60
Merge trung bình
5 ngày 14 giờ
Pull request đã merge (30 ngày)
124

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ExtendDB/extenddb

Tất cả issue của ExtendDB/extenddb

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.