Skip to content

Conversation

@mildbyte
Copy link
Contributor

This simplifies shutdown handling and means that if a subsystem fails to start (panics), Seafowl exits.

Tested manually (set flight port to an already-used one):

2024-04-11T12:26:00.638088Z  INFO main ThreadId(01) seafowl: Starting Seafowl 0.5.5
2024-04-11T12:26:00.638236Z  INFO main ThreadId(01) seafowl: Loading the configuration from seafowl.toml
2024-04-11T12:26:00.658400Z  INFO tokio-runtime-worker ThreadId(19) seafowl: Starting the Arrow Flight frontend on 127.0.0.1:9000
2024-04-11T12:26:00.658437Z  INFO tokio-runtime-worker ThreadId(15) seafowl: Starting the PostgreSQL frontend on 127.0.0.1:6432
2024-04-11T12:26:00.658486Z  WARN tokio-runtime-worker ThreadId(15) seafowl: The PostgreSQL frontend doesn't have authentication or encryption and should only be used in development!
2024-04-11T12:26:00.658480Z  INFO tokio-runtime-worker ThreadId(20) seafowl: Starting the HTTP frontend on 0.0.0.0:8080
2024-04-11T12:26:00.658540Z  INFO tokio-runtime-worker ThreadId(20) seafowl: HTTP access settings: read any, write off
thread 'tokio-runtime-worker' panicked at [...]seafowl/src/frontend/flight/mod.rs:43:10:
called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 98, kind: AddrInUse, message: "Address already in use" }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2024-04-11T12:26:00.658851Z ERROR tokio-runtime-worker ThreadId(19) tokio_graceful_shutdown::toplevel: Uncaught panic from subsytem '/Arrow Flight frontend'.
2024-04-11T12:26:00.658944Z  INFO tokio-runtime-worker ThreadId(20) seafowl::frontend::http: Shutting down Warp...
2024-04-11T12:26:00.658950Z  INFO                 main ThreadId(01) tokio_graceful_shutdown::toplevel: Shutting down ...
2024-04-11T12:26:00.660439Z  WARN                 main ThreadId(01) tokio_graceful_shutdown::toplevel: Shutdown finished with errors.
thread 'main' panicked at src/main.rs:255:12:
called `Result::unwrap()` on an `Err` value: SubsystemsFailed([Panicked("/Arrow Flight frontend")])

normal shutdown:

2024-04-11T12:41:52.156355Z  INFO main ThreadId(01) seafowl: Starting Seafowl 0.5.5
2024-04-11T12:41:52.156622Z  INFO main ThreadId(01) seafowl: Loading the configuration from seafowl.toml
2024-04-11T12:41:52.183805Z  INFO tokio-runtime-worker ThreadId(21) seafowl: Starting the Arrow Flight frontend on 127.0.0.1:47470
2024-04-11T12:41:52.183844Z  INFO tokio-runtime-worker ThreadId(19) seafowl: Starting the PostgreSQL frontend on 127.0.0.1:6432
2024-04-11T12:41:52.183895Z  WARN tokio-runtime-worker ThreadId(19) seafowl: The PostgreSQL frontend doesn't have authentication or encryption and should only be used in development!
2024-04-11T12:41:52.183924Z  INFO tokio-runtime-worker ThreadId(15) seafowl: Starting the HTTP frontend on 0.0.0.0:8080
2024-04-11T12:41:52.183986Z  INFO tokio-runtime-worker ThreadId(15) seafowl: HTTP access settings: read any, write off

^C

2024-04-11T12:41:53.264914Z  INFO tokio-runtime-worker ThreadId(04) seafowl::frontend::flight: Shutting down Flight frontend...
2024-04-11T12:41:53.264981Z  INFO tokio-runtime-worker ThreadId(15) seafowl::frontend::http: Shutting down Warp...
2024-04-11T12:41:53.265353Z  INFO                 main ThreadId(01) tokio_graceful_shutdown::toplevel: Shutting down ...
2024-04-11T12:41:53.269040Z  INFO                 main ThreadId(01) tokio_graceful_shutdown::toplevel: Shutdown finished.
2024-04-11T12:41:53.269133Z  INFO                 main ThreadId(01) seafowl: Exiting cleanly.

@mildbyte mildbyte requested a review from gruuya April 11, 2024 12:42
We get some weird `left behind trailing whitespace error`, delete
some newlines so it stops crashing
@mildbyte mildbyte merged commit 7d2289b into main Apr 11, 2024
@mildbyte mildbyte deleted the feature/tokio-graceful-shutdown branch April 11, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants