SIGTERM and SIGINT always shut down tokio runtime when using `#[actix::main]`
- 主要言語
- 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 はまだ評価されていません。