From e3f9b54819270675b1103b2b15ed38bf05c8c43c Mon Sep 17 00:00:00 2001 From: Simo Lin Date: Sun, 29 Jun 2025 15:38:28 -0700 Subject: [PATCH] [bugfix] fix runtime dropping panic in editable (#7628) --- sgl-router/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sgl-router/src/lib.rs b/sgl-router/src/lib.rs index cd1f0c154..1f7e3c8f7 100644 --- a/sgl-router/src/lib.rs +++ b/sgl-router/src/lib.rs @@ -272,7 +272,12 @@ impl Router { .unwrap_or_else(|| "127.0.0.1".to_string()), }); - actix_web::rt::System::new().block_on(async move { + // Use tokio runtime instead of actix-web System for better compatibility + let runtime = tokio::runtime::Runtime::new() + .map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string()))?; + + // Block on the async startup function + runtime.block_on(async move { server::startup(server::ServerConfig { host: self.host.clone(), port: self.port, @@ -286,8 +291,7 @@ impl Router { request_timeout_secs: self.request_timeout_secs, }) .await - .map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string()))?; - Ok(()) + .map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string())) }) } }