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.
This commit is contained in:
Michel de Graaf
2026-09-10 10:15:46 +02:00
parent 1b4c3f3531
commit f620ffa08f
+4 -4
View File
@@ -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");
}