You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When I use a Chromium based browser, the graceful shutdown hangs.
The minimal reproducible code is as follows:
use std::net::Ipv4Addr;
use tokio::{signal::ctrl_c, sync::oneshot};
use warp::Filter;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.init();
let (shutdown_s, shutdown_r) = oneshot::channel();
let graceful_shutdown = async move {
shutdown_r.await.ok();
};
let routes = warp::any().map(|| "hello");
let (_, fut) = warp::serve(routes)
.try_bind_with_graceful_shutdown((Ipv4Addr::LOCALHOST, 8080), graceful_shutdown)?;
let routine = tokio::spawn(fut);
tracing::info!("started!");
ctrl_c().await?;
shutdown_s.send(()).ok();
Ok(routine.await?)
}
Then, when you open a Chromium-based browser (such as Edge), visit 127.0.0.1:8080, and then press ctrl-c in the terminal, graceful shutdown will hang until the entire browser is completely closed (if you have other tabs, closing the current tab will have no effect, and graceful shutdown will remain stuck).
Typical log output for this code is as follows:
2024-05-08T14:45:49.179092Z INFO repr: started!
2024-05-08T14:45:51.538331Z DEBUG hyper::proto::h1::io: parsed 15 headers
2024-05-08T14:45:51.538971Z DEBUG hyper::proto::h1::conn: incoming body is empty
2024-05-08T14:45:51.539646Z DEBUG hyper::proto::h1::io: flushed 121 bytes
2024-05-08T14:45:51.607208Z DEBUG hyper::proto::h1::io: parsed 13 headers
2024-05-08T14:45:51.607625Z DEBUG hyper::proto::h1::conn: incoming body is empty
2024-05-08T14:45:51.608183Z DEBUG hyper::proto::h1::io: flushed 121 bytes
2024-05-08T14:45:53.140266Z DEBUG hyper::server::shutdown: signal received, starting graceful shutdown
Then it will stay stuck here until the browser is completely closed.
After I patched hyper-util, their problems were solved. However, patch hyper-util has no effect on warp, and the problem still exists after patching.
So for warp, I hope we can also fix this bug, or if there are any ready-made hox-fix or workaround mitigation solutions, I hope we can provide them, thank you!
The text was updated successfully, but these errors were encountered:
Version
v0.3.7
Platform
64-bit Windows 10
Description
When I use a Chromium based browser, the graceful shutdown hangs.
The minimal reproducible code is as follows:
Then, when you open a Chromium-based browser (such as Edge), visit
127.0.0.1:8080
, and then pressctrl-c
in the terminal, graceful shutdown will hang until the entire browser is completely closed (if you have other tabs, closing the current tab will have no effect, and graceful shutdown will remain stuck).Typical log output for this code is as follows:
Then it will stay stuck here until the browser is completely closed.
I tried Axum before and found that they also have the same problem: tokio-rs/axum#2611
But it seems that their problem is caused by a bug in
hyper-util
:hyperium/hyper#3576
hyperium/hyper-util#101
After I patched
hyper-util
, their problems were solved. However, patchhyper-util
has no effect on warp, and the problem still exists after patching.So for
warp
, I hope we can also fix this bug, or if there are any ready-made hox-fix or workaround mitigation solutions, I hope we can provide them, thank you!The text was updated successfully, but these errors were encountered: