From 4ac96e959d69f3c0b68dfae2f85fc23e69fa8ead Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 23:13:52 +0200 Subject: [PATCH] Route connect test: the listener never accepts, so the test cannot hang route_connect_retries_connection_refused_until_listener_is_ready blocked in accept() with no deadline. If the client connected to another listener on the reused port, accept() waited forever and the whole verify job held its slot for 39 minutes. The kernel completes a handshake from a listener's backlog, so the connect succeeds without an accept: the listener now only outlives the connect, waiting on a channel with a 30 s ceiling. A lost port race fails the test instead of hanging it. Builds. Co-Authored-By: Claude Sonnet 5.5 --- src/drivers.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/drivers.rs b/src/drivers.rs index 9bf4372..bc4873f 100644 --- a/src/drivers.rs +++ b/src/drivers.rs @@ -9327,18 +9327,25 @@ Content-Le".to_vec()), |_| {}), let address = reservation.local_addr()?; drop(reservation); + // The listener never accepts: the kernel completes a handshake from + // its backlog, so the client connects as soon as it is bound. Nothing + // here can block on a connection that never arrives; the listener only + // has to outlive the connect, and gives up waiting after a bound. + let (connected, connect_done) = std::sync::mpsc::channel::<()>(); let server = thread::spawn(move || -> std::io::Result<()> { thread::sleep(Duration::from_millis(75)); let listener = std::net::TcpListener::bind(address)?; - let (_stream, _) = listener.accept()?; + let _ = connect_done.recv_timeout(Duration::from_secs(30)); + drop(listener); Ok(()) }); - let stream = connect_route_socket(address)?; - drop(stream); + let stream = connect_route_socket(address); + let _ = connected.send(()); server .join() .map_err(|_| anyhow!("route readiness test server panicked"))??; + drop(stream?); Ok(()) }