Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] - Graceful shutdown - Hosting Services & clean exit #20

Open
MrDwarf7 opened this issue Jan 7, 2025 · 0 comments · May be fixed by #21
Open

[feat] - Graceful shutdown - Hosting Services & clean exit #20

MrDwarf7 opened this issue Jan 7, 2025 · 0 comments · May be fixed by #21

Comments

@MrDwarf7
Copy link

MrDwarf7 commented Jan 7, 2025

Description

Currently, when shutting down the main server loop, the vectored launcher/custom join_all which is called in
main->crate::util::tasks::join_all() does not properly/fully exit upon SIGINT/SIGTERM.

This results in a partial or “hung” shutdown state that never actually completes.
Implementing a graceful shutdown handler will ensure the primary server loop and all the child services quit cleanly once the shutdown future completes.

This is the recommended approach by Axum/Tokio for shutdowns from what I understand.
If there's a reason I've missed (Perhaps something to do with the Messenger) then please clarify for me so I can understand the intention.

Why It’s Needed

Provides a more reliable and consistent shutdown flow.
Prevents lingering resources or partial states when stopping the application.
Aligns behavior with best practices for asynchronous service shutdown.

Proposed Fix

Add a graceful shutdown handler that triggers on service stop signals (e.g., SIGINT, SIGTERM).
Update the vectored launcher to correctly exit after the shutdown future completes.

Acceptance Criteria

Server resources/clients stop and release resources properly when a shutdown signal is triggered.
Vectored launcher cleanly terminates without leaving any dangling tasks
No observable hangs or partial shutdown states.

A pull request (PR) referencing this issue will be opened shortly to implement the above changes.

@MrDwarf7 MrDwarf7 linked a pull request Jan 7, 2025 that will close this issue
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 a pull request may close this issue.

1 participant