diff --git a/consensus/core/src/network/tonic_network.rs b/consensus/core/src/network/tonic_network.rs index 486cd54c210a4e..9b4ca009d52af1 100644 --- a/consensus/core/src/network/tonic_network.rs +++ b/consensus/core/src/network/tonic_network.rs @@ -895,13 +895,10 @@ impl NetworkManager for TonicManager { }, _ = shutdown_notif.wait(), if !has_shutdown => { trace!("Received shutdown. Stopping connection for {peer_addr:?}"); + connection.as_mut().graceful_shutdown(); has_shutdown = true; }, } - - if has_shutdown { - break; - } } Ok(()) diff --git a/crates/sui-proxy/src/histogram_relay.rs b/crates/sui-proxy/src/histogram_relay.rs index 3591a7c6004612..41635819fefb9a 100644 --- a/crates/sui-proxy/src/histogram_relay.rs +++ b/crates/sui-proxy/src/histogram_relay.rs @@ -61,6 +61,7 @@ pub fn start_prometheus_server(listener: TcpListener) -> HistogramRelay { ); tokio::spawn(async move { + listener.set_nonblocking(true).unwrap(); let listener = tokio::net::TcpListener::from_std(listener).unwrap(); axum::serve(listener, app).await.unwrap(); }); diff --git a/crates/sui-proxy/src/lib.rs b/crates/sui-proxy/src/lib.rs index 7c9ee0e174b132..c2246284216ad1 100644 --- a/crates/sui-proxy/src/lib.rs +++ b/crates/sui-proxy/src/lib.rs @@ -61,6 +61,7 @@ mod tests { let app = Router::new().route("/v1/push", post(handler)); // run it + listener.set_nonblocking(true).unwrap(); let listener = tokio::net::TcpListener::from_std(listener).unwrap(); axum::serve(listener, app).await.unwrap(); } diff --git a/crates/sui-proxy/src/metrics.rs b/crates/sui-proxy/src/metrics.rs index 3252b13a0fc050..063d7fefd967cc 100644 --- a/crates/sui-proxy/src/metrics.rs +++ b/crates/sui-proxy/src/metrics.rs @@ -33,6 +33,7 @@ pub fn start_prometheus_server(listener: TcpListener) -> RegistryService { ); tokio::spawn(async move { + listener.set_nonblocking(true).unwrap(); let listener = tokio::net::TcpListener::from_std(listener).unwrap(); axum::serve(listener, app).await.unwrap(); }); diff --git a/crates/sui-source-validation-service/src/lib.rs b/crates/sui-source-validation-service/src/lib.rs index f26fc28d632701..2654a92f723732 100644 --- a/crates/sui-source-validation-service/src/lib.rs +++ b/crates/sui-source-validation-service/src/lib.rs @@ -459,6 +459,7 @@ pub async fn serve(app_state: Arc>) -> anyhow::Result<()> { ) .with_state(app_state); let listener = TcpListener::bind(host_port())?; + listener.set_nonblocking(true).unwrap(); let listener = tokio::net::TcpListener::from_std(listener)?; axum::serve(listener, app).await?; Ok(()) @@ -608,6 +609,7 @@ pub fn start_prometheus_server(listener: TcpListener) -> RegistryService { .layer(Extension(registry_service.clone())); tokio::spawn(async move { + listener.set_nonblocking(true).unwrap(); let listener = tokio::net::TcpListener::from_std(listener).unwrap(); axum::serve(listener, app).await.unwrap(); }); diff --git a/narwhal/primary/tests/nodes_bootstrapping_tests.rs b/narwhal/primary/tests/nodes_bootstrapping_tests.rs index 60c0c2293c5d53..373676bfe7cb1f 100644 --- a/narwhal/primary/tests/nodes_bootstrapping_tests.rs +++ b/narwhal/primary/tests/nodes_bootstrapping_tests.rs @@ -40,12 +40,7 @@ async fn test_response_error_after_shutdown_internal_consensus() { let Err(e) = client.submit_transaction(txn).await else { panic!("Submitting transactions after Narwhal shutdown should fail!"); }; - assert!( - e.message() - .contains("error trying to connect: tcp connect error:"), - "Actual: {}", - e - ); + assert!(e.message().contains("tcp connect error:"), "Actual: {}", e); } /// Nodes will be started in a staggered fashion. This is simulating