From f620ffa08fb7e860f2f9e674b7fd10befc0358bf Mon Sep 17 00:00:00 2001 From: Michel de Graaf Date: Thu, 10 Sep 2026 10:15:46 +0200 Subject: [PATCH] test: give the hung-up child's reap a wall-clock budget A dead child only loses its slot once a write to it fails, and writes keep landing in the send buffer until the peer's RST has crossed the loopback. Fifty back-to-back writes finish in microseconds, so under full-suite load the loop ran dry before the kernel noticed the close and the assertion fired. Sleep 5 ms between attempts that have not reaped yet, bounded at 100 tries: the fast path still exits on the second write, a loaded machine gets up to half a second. --- soulseek-rs-lib/src/client/children.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/soulseek-rs-lib/src/client/children.rs b/soulseek-rs-lib/src/client/children.rs index 45fad3f..e60916d 100644 --- a/soulseek-rs-lib/src/client/children.rs +++ b/soulseek-rs-lib/src/client/children.rs @@ -403,14 +403,14 @@ mod tests { children.accept("alice", ours); drop(child); - // The first write after the peer is gone may still be buffered; the - // second is the one that fails. Either way the child must not keep - // its slot forever. - for _ in 0..50 { + // Writes keep landing in the send buffer until the peer's RST has + // crossed the loopback, which under load takes real wall-clock time. + for _ in 0..100 { children.broadcast_search("seeker", 1, "q"); if children.is_empty() { break; } + std::thread::sleep(std::time::Duration::from_millis(5)); } assert!(children.is_empty(), "a dead child is dropped"); }