actix / actix/actix-web

SIGTERM and SIGINT always shut down tokio runtime when using `#[actix::main]`

オープン
#3,123 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
needs-investigation
主要言語
Rust
スター
24.8k
フォーク
1.9k
平均マージ
23時間 10分
マージ済み PR(30日)
26

説明

I have a project where I spawn some background tasks before starting the `HttpServer`, and when the server has stopped, I notify the tasks and join them, which means there is still some code running between the server shutdown and the program exit. However, when stopping the server with SIGINT (Ctrl+C) or SIGTERM (using kill), it immediatly shuts down Tokio, which results in errors like `error importing requests: Execution Error: error communicating with database: A Tokio 1.x context was found, but it is being shutdown.` from the background tasks. The only thing I found was `HttpServer::system_exit`, which is supposed to "[flag] the System to exit after server shutdown", however, in my case I don't call this function and the system shutdown still seems to happen. My current workaround for this is to use `#[tokio::main]` instead of `#[actix::main]`, but I think it would be nice to have the entire system not shutdown after the server stops.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。