Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

prune_kv_values_updated_before emits actions in HashMap order; replay fails with `kv clear mismatch`

Đang mở
#57 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

@akhil9tiet đang làm issue này rồi.

Từ ngày 4/10/2026.

  • #62 của @akhil9tiet — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
node.js, rust
Lĩnh vực
distributed-systems

Hướng nghiên cứu

Start in src/lib.rs at prune_kv_values_updated_before (around lines 3411-3427), then inspect get_kv_all_keys around lines 3360-3362 and the kv_metadata declaration around line 1715. Reproduce the Node.js SDK scenario with multiple matching keys and verify that replay emits and consumes KV actions in a consistent order.

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

Mô tả

bug

Summary

An orchestration that prunes two or more KV keys in one turn fails on a later replay with nondeterministic: kv clear mismatch. The orchestration code is deterministic. The order of the actions that the runtime emits is not.

Where

A HashMap has a random seed per map. So the iteration order differs between two replays of the same turn, also inside one process.

How it fails

  1. Execution 1 writes the keys a to f and continues as new.
  2. Execution 2 calls prune_kv_values_updated_before(cutoff). All six keys match. The turn records six KeyValueCleared events in some order.
  3. A later turn replays the same code. The six ClearKeyValue actions come out in a different order.
  4. The replay engine compares the first action with the first event, finds another key, and fails the orchestration.

Reproduction

Reproduced with duroxide 0.1.30 on SQLite, through the Node.js SDK:

runtime.registerOrchestration('Prune', function* (ctx, input) {
  if (!input || !input.second) {
    for (const k of ['a', 'b', 'c', 'd', 'e', 'f']) ctx.setValue(k, 'x');
    yield ctx.continueAsNew({ second: true });
    return '';
  }
  const now = yield ctx.utcNow();
  const pruned = ctx.pruneKvValuesUpdatedBefore(now + 60_000); // clears all six keys
  yield ctx.utcNow();
  yield ctx.utcNow();
  return `pruned ${pruned}`;
});

6 of 6 instances failed, for example with:

nondeterministic: kv clear mismatch: action=ClearKeyValue { key: "d" } vs event=KeyValueCleared { key: "a" }

Impact

  • An orchestration that calls prune_kv_values_updated_before with more than one matching key can fail for good. With n keys, two replays agree on the order with a chance of 1 in n!.
  • get_kv_all_keys and get_kv_all_values hand the same random order to orchestration code. Code that loops over the result and schedules work per key is nondeterministic for the same reason.

Suggested fix

  • Sort the keys in prune_kv_values_updated_before before the actions are emitted.
  • Return sorted keys from get_kv_all_keys, or keep the KV state in a BTreeMap.

Tracked in #55.

Ngôn ngữ chính
Rust
Star
221
Fork
61
Merge trung bình
3 ngày 5 giờ
Pull request đã merge (30 ngày)
1

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 microsoft/duroxide

Tất cả issue của microsoft/duroxide

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.