ntex-rs / ntex

framework for composable networking services
Apache License 2.0
1.84k stars 105 forks source link

Program panicks upon ctrl+c #324

Closed starkbamse closed 3 months ago

starkbamse commented 3 months ago
#[ntex::main]
async fn main() -> std::io::Result<()> {
    let _ = database::setup::setup();
    start_polling();

    web::HttpServer::new(|| {
        web::App::new()
        .service(hello)
            .service(
                // Setting up a scope for all keys-related routes
                web::scope("/api/v1/keys")
                    .configure(controllers::keys::config) // Utilizing the configuration from controllers::keys
            )
            .service(
                // Setting up a scope for all keys-related routes
                web::scope("/api/v1/admins")
                    .configure(controllers::admins::config) // Utilizing the configuration from controllers::keys
            )

    })
    .bind("0.0.0.0:5000")?
    .run()
    .await
}

Doing ctrl+c results in:

^Cthread 'ntex-server signals' panicked at /home/starkbamse/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntex-rt-0.4.12/src/system.rs:59:21:
System is not running
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

How can we shut down a server without panic?

fafhrd91 commented 3 months ago

could you try master

starkbamse commented 3 months ago

Im not on windows, arch linux @fafhrd91

fafhrd91 commented 3 months ago

ntex-server with the fix is released