From 7d98247cb066fe60a1734075cf52332fb1b4c8a6 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Thu, 4 Nov 2021 23:00:43 +0000 Subject: [PATCH 1/2] fix server worker name --- actix-rt/CHANGES.md | 2 ++ actix-server/src/worker.rs | 2 +- actix-server/tests/test_server.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/actix-rt/CHANGES.md b/actix-rt/CHANGES.md index 0ac9f24a..60b40de6 100644 --- a/actix-rt/CHANGES.md +++ b/actix-rt/CHANGES.md @@ -2,7 +2,9 @@ ## Unreleased - 2021-xx-xx * Add `Arbiter::try_current` for situations where thread may or may not have Arbiter context. [#408] +* Start io-uring with `System::new` when feature is enabled. [#395] +[#395]: https://github.com/actix/actix-net/pull/395 [#408]: https://github.com/actix/actix-net/pull/408 diff --git a/actix-server/src/worker.rs b/actix-server/src/worker.rs index c156444b..44465bd3 100644 --- a/actix-server/src/worker.rs +++ b/actix-server/src/worker.rs @@ -299,7 +299,7 @@ impl ServerWorker { // TODO: wait for server startup with sync channel std::thread::Builder::new() - .name("eofibef".to_owned()) + .name(format!("actix-server worker {}", idx)) .spawn(move || { // forward existing actix system context if let Some(sys) = sys { diff --git a/actix-server/tests/test_server.rs b/actix-server/tests/test_server.rs index 78bc64e4..0506586e 100644 --- a/actix-server/tests/test_server.rs +++ b/actix-server/tests/test_server.rs @@ -312,7 +312,7 @@ async fn test_service_restart() { h.join().unwrap().unwrap(); } -#[cfg_attr(not(target_os = "linux"), ignore)] +#[ignore] // non-deterministic on CI #[actix_rt::test] async fn worker_restart() { use actix_service::{Service, ServiceFactory}; From 15279eaf3d21738d766f33e0f5e50ebd9289db7d Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Thu, 4 Nov 2021 23:26:56 +0000 Subject: [PATCH 2/2] sync wait for service factories to be ready --- actix-server/src/worker.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/actix-server/src/worker.rs b/actix-server/src/worker.rs index 44465bd3..af14ab4b 100644 --- a/actix-server/src/worker.rs +++ b/actix-server/src/worker.rs @@ -296,7 +296,8 @@ impl ServerWorker { // get actix system context if it is set let sys = System::try_current(); - // TODO: wait for server startup with sync channel + // service factories initialization channel + let (factory_tx, factory_rx) = std::sync::mpsc::sync_channel(1); std::thread::Builder::new() .name(format!("actix-server worker {}", idx)) @@ -350,6 +351,8 @@ impl ServerWorker { } }; + factory_tx.send(()).unwrap(); + // a third spawn to make sure ServerWorker runs as non boxed future. spawn(ServerWorker { rx, @@ -369,6 +372,9 @@ impl ServerWorker { }) .expect("worker thread error/panic"); + // wait for service factories initialization + factory_rx.recv().unwrap(); + Ok(handle_pair(idx, tx1, tx2, counter)) }