From 27ccf626a4f50a69da0478e6923acef8a65ad142 Mon Sep 17 00:00:00 2001 From: Mericas77 <298731330+Mericas77@users.noreply.github.com> Date: Wed, 25 Nov 2026 00:43:33 +0000 Subject: [PATCH] GPU tests: a batch's hold on a copy ends before its pool is freed a_copy_is_refreshed_once_per_submission_by_the_pages_written kept both of its Batch values (the first shadowed, not dropped) until the end of the test, after crate::watch::tests::free(p). A Batch holds an Arc, so the copy watching the pool outlived the pool, whose addresses a watch test running in parallel could take. The second batch now replaces the first, and is dropped before the pool is freed. On an RTX 4070: `cargo test -p victory-gpu --lib`, 20 parallel runs, watch::tests failures in 11 of 20 at 70564ae, 0 of 20 with this change. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PRMwrhHQKoSVGhHr7Xy53Z --- crates/victory-gpu/src/host.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/victory-gpu/src/host.rs b/crates/victory-gpu/src/host.rs index c25381b231..1bbe991eac 100644 --- a/crates/victory-gpu/src/host.rs +++ b/crates/victory-gpu/src/host.rs @@ -2528,7 +2528,7 @@ mod batch { // Batch::texture_due lives here; `mod tests` is already taken at // SAFETY: our pool, guarded since the copy took it. unsafe { ((p + PAGE + 8) as *mut u8).write_volatile(7) }; // The next submission: two lists ask for the copy. - let mut batch = Batch::default(); + batch = Batch::default(); batch.add(©, p, len); batch.add(©, p + 100, 200); assert_eq!(batch.flush(), PAGE, "the page written"); @@ -2541,6 +2541,9 @@ mod batch { // Batch::texture_due lives here; `mod tests` is already taken at batch.add(©, p, len); assert_eq!(batch.flush(), PAGE, "after a title write, what changed"); crate::shadow::unregister(p, p as u64); + // The batch holds the copy, which watches the pool: gone before the + // pool, whose addresses a test running beside this one may take. + drop(batch); drop(copy); crate::watch::tests::free(p); }