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

[server] Use proper graceful shutdown #812

Closed
agnesoft opened this issue Nov 27, 2023 · 1 comment · Fixed by #943
Closed

[server] Use proper graceful shutdown #812

agnesoft opened this issue Nov 27, 2023 · 1 comment · Fixed by #943
Assignees

Comments

@agnesoft
Copy link
Owner

Graceful shutdown is no longer available in hyper 1.0 and thus in axum 0.7. There is open issue for it to be re-added in hyper-utils: hyperium/hyper#2862

The new way of doing graceful shutdown is to manually implement the server (axum::serve method) and it also forces the choice to exclusively use http1(.1) or http2. Neither is very appealing with the latter being a deal breaker.

Current implementation simply cancels the server possibly causing data loss for clients. The databases even for open transactions will be ok (on drop the transactions get aborted and data integrity restored due to write ahead log (WAL) ).

Two options:

  1. Prevent client data loss by tracking open requests and stopping serving new ones (probably in the logger layer?) when shutdown is invoked. Let the main cancel the server as normal once the ongoing requests reach 0.

  2. Use proper graceful shutdown when it becomes available in hyper.

@agnesoft agnesoft added the bug label Nov 27, 2023
@agnesoft agnesoft added this to agdb Nov 27, 2023
@agnesoft agnesoft moved this to Todo in agdb Nov 27, 2023
@agnesoft
Copy link
Owner Author

agnesoft commented Dec 5, 2023

Is being fixed by:

hyperium/hyper#3457 (merged)
hyperium/hyper-util#66 (merged)
tokio-rs/axum#2398 (merged)

@michaelvlach michaelvlach self-assigned this Dec 29, 2023
@michaelvlach michaelvlach moved this from Todo to In Progress in agdb Dec 30, 2023
@michaelvlach michaelvlach linked a pull request Dec 30, 2023 that will close this issue
michaelvlach added a commit that referenced this issue Dec 30, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in agdb Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants