community: every ledger takes its write lock, so the inbox check can no longer land on top of a friend accept

This commit is contained in:
KeelrLeek committed 2026-09-03 11:51:35 -05:00
1 parent 07227a90a7
commit 4d03cf849b
6 files changed
+89 -29

No files matched your search

+12
View File
@@ -63,6 +63,18 @@ mod tests {
assert_eq!(CELL.load(Ordering::SeqCst), 2, "the second write clobbered the first");
}
/// Why spaces::invite, spaces::remove_member and proposals::decide all
/// `drop(ledger)` before their tail call into open(): this lock is NOT
/// reentrant, so re-taking the same file in the same task is a hang, not
/// an error. Nothing in the compiler catches that.
#[tokio::test]
async fn the_same_file_twice_would_hang() {
let _first = hold("test-reentrant.json").await;
let again =
tokio::time::timeout(std::time::Duration::from_millis(200), hold("test-reentrant.json")).await;
assert!(again.is_err(), "a second hold on an already-held file must never be granted");
}
/// Different files must not block each other, or dispatching sealed cargo
/// out of a held inbox would deadlock.
#[tokio::test]