From 77939bd3f320ad87bb9f8ce08818a75f611caed7 Mon Sep 17 00:00:00 2001 From: Hasyimi Bahrudin Date: Tue, 17 Nov 2026 21:48:48 +0800 Subject: [PATCH] test: stop the keepalive-flood test hanging forever standby_is_serviced_under_keepalive_flood held the events receiver without draining it. When the flood filled the 1000-slot channel before the test set `stop`, the reader parked forever delivering its "stream closed" error, and `reader.await` never returned: CI's `cargo test` then ran until GitHub's 6h timeout cancelled it (#150, #151, main at 726e863). Drop the receiver before stopping the flood. Co-Authored-By: Claude Opus 5.5 --- crates/pg2iceberg-pg/src/prod/stream.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/pg2iceberg-pg/src/prod/stream.rs b/crates/pg2iceberg-pg/src/prod/stream.rs index cf87388..f24375a 100644 --- a/crates/pg2iceberg-pg/src/prod/stream.rs +++ b/crates/pg2iceberg-pg/src/prod/stream.rs @@ -801,7 +801,7 @@ mod reader_tests { stop: stop.clone(), wal_end: 0, }; - let (events_tx, _events_rx) = + let (events_tx, events_rx) = mpsc::channel::>(EVENTS_CHANNEL_CAPACITY); let (cmd_tx, cmd_rx) = mpsc::channel::(CMD_CHANNEL_CAPACITY); let reader = tokio::spawn(reader_task(wire, HashMap::new(), events_tx, cmd_rx)); @@ -823,6 +823,10 @@ mod reader_tests { // Stop the flood so the reader exits cleanly regardless of outcome // (it polls `next()` every iteration even when stream-biased). + // Drop the receiver first: nothing drains it, so the flood fills + // it once it runs long enough, and the reader would park forever + // delivering its "stream closed" error into the full channel. + drop(events_rx); stop.store(true, Ordering::Relaxed); let _ = reader.await;