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

Improve the server shutdown process #1104

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Mar 5, 2025

Motivation:

When a Central Dogma server stops, it first closes GitRepository and other resources internally. The shutdown process does not respect GracefulShutdownTimeout but immediately closes them. As a result, inflight requests fail with ShuttingDownException even though they were received before the shutdown process started.

To gracefully shut down the server, I propose closing the Armeria server first. During the Armeria shutdown process, it will wait for requests to be finished during the GracefulShutdownTimeout.

Motifications:

  • Close the server first and then shut down other resources.
  • Configure Armeria GracefulShutdown to fail long-running requests with ShuttingdownException
  • Fix HttpApiExceptionHandler to return 304 Not Modified for watch requests after the graceful shutdown timeout.

Result:

The Central Dogma server gracefully terminates requests while respecting GracefulShutdownTimeout.

Motivation:

When a Central Dogma server stops, it first closes  `GitRepository` and
other resources internally. The shutdown process does not respect
`GracefulShutdownTimeout` but immediately closes them. As a result,
inflight requests fail with `ShuttingDownException` even though they
were received before the shutdown process started.

To gracefully shut down the server, I propose closing the Armeria server
first. During the Armeria shutdown process, it will wait for requests to
be finished during the GracefulShutdownTimeout.

Motifications:

- Close the server first and then shut down other resources.
- Configure Armeria `GracefulShutdown` to fail long-running requests
  with `ShuttingdownException`
- Fix `HttpApiExceptionHandler` to return 304 Not Modified for watch
  requests after the graceful shutdown timeout.

Result:

The Central Dogma server gracefully terminates requests while
respecting `GracefulShutdownTimeout`.

# Conflicts:
#	dependencies.toml
@ikhoon ikhoon added this to the 0.75.0 milestone Mar 5, 2025
@ikhoon ikhoon marked this pull request as ready for review March 5, 2025 13:57
Copy link
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants