From db375a8cf860611341d4ac4eecd1b4eef8bac622 Mon Sep 17 00:00:00 2001 From: Hauser Date: Sun, 1 Nov 2026 14:42:52 +0800 Subject: [PATCH] test(ecstore): avoid lock cleanup refcount race Co-Authored-By: heihutu Co-Authored-By: zhi22915 --- crates/ecstore/src/set_disk/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/ecstore/src/set_disk/mod.rs b/crates/ecstore/src/set_disk/mod.rs index 744a37a9c..a895555da 100644 --- a/crates/ecstore/src/set_disk/mod.rs +++ b/crates/ecstore/src/set_disk/mod.rs @@ -9038,6 +9038,13 @@ mod tests { "constructing an object lock must not clone each client Arc" ); + // Check shared ownership before acquisition can spawn pending cleanup. + let read_lock = set + .new_ns_lock("bucket", "read-object") + .await + .expect("second namespace lock should be created"); + assert_eq!(Arc::strong_count(&set.shared_lockers), clients_before + 2); + let write_error = write_lock .get_write_lock(Duration::from_millis(500)) .await @@ -9052,11 +9059,6 @@ mod tests { ), "the shared client representation must preserve the exact write quorum result: {write_error}" ); - let read_lock = set - .new_ns_lock("bucket", "read-object") - .await - .expect("second namespace lock should be created"); - assert_eq!(Arc::strong_count(&set.shared_lockers), clients_before + 2); let read_guard = read_lock .get_read_lock(Duration::from_millis(500)) .await