Skip to content

Add documentation for GracefulShutdown#6713

Open
PreAgile wants to merge 3 commits intoline:mainfrom
PreAgile:docs/graceful-shutdown-6345
Open

Add documentation for GracefulShutdown#6713
PreAgile wants to merge 3 commits intoline:mainfrom
PreAgile:docs/graceful-shutdown-6345

Conversation

@PreAgile
Copy link
Copy Markdown
Contributor

@PreAgile PreAgile commented Apr 8, 2026

Motivation:

Users frequently ask about GracefulShutdown configuration, but there is no
dedicated documentation page. The only references exist in release notes and
Spring Boot integration code, making it hard for users to discover and
understand the graceful shutdown behavior.

Modifications:

  • Add a new documentation page at server/graceful-shutdown.mdx covering:
    • How graceful shutdown works (quiet period and timeout phases)
    • Basic configuration via ServerBuilder.gracefulShutdownTimeout()
    • Advanced configuration via GracefulShutdown.builder() with custom
      shutdown responses using toExceptionFunction()
    • Spring Boot integration properties and default values
    • Best practices for load balancer and health check coordination
  • Add server/graceful-shutdown entry to sidebars.ts under the Server
    category, after timeouts

Result:

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00f91949-693a-4b16-b5fb-5295a6ab62d9

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf6527 and 33b9240.

📒 Files selected for processing (1)
  • site-new/src/content/docs/server/graceful-shutdown.mdx
✅ Files skipped from review due to trivial changes (1)
  • site-new/src/content/docs/server/graceful-shutdown.mdx

📝 Walkthrough

Walkthrough

Added a new documentation page for Armeria's graceful shutdown and updated the site sidebar to include the new page. The doc describes the two-phase shutdown (quiet period + timeout), configuration APIs, Spring Boot integration defaults, and operational guidance.

Changes

Cohort / File(s) Summary
Sidebar update
site-new/sidebars.ts
Appended server/graceful-shutdown to the Server docs sidebar items.
Graceful shutdown docs
site-new/src/content/docs/server/graceful-shutdown.mdx
Added new documentation covering two-phase graceful shutdown (quiet period + timeout), configuration via ServerBuilder.gracefulShutdownTimeout(...) and GracefulShutdown.builder(), customizing shutdown responses via toExceptionFunction(...) and errorHandler(...), Spring Boot property defaults and overrides, and best-practice guidance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • trustin
  • ikhoon
  • minwoox

Poem

🐰 I hopped through lines of quiet and time,
Wrote how servers bow out, calm and fine,
Sidebar nudged, a new page to show,
Gentle exits, so traffic can flow,
A rabbit's nod — soft shutdown, on go.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add documentation for GracefulShutdown' accurately and concisely describes the main change: adding new documentation content for the GracefulShutdown feature.
Description check ✅ Passed The description is well-structured and clearly related to the changeset, explaining motivation, modifications made (new doc page and sidebar entry), and results with issue reference.
Linked Issues check ✅ Passed The PR fully addresses the primary objective from #6345 by adding comprehensive documentation for GracefulShutdown covering configuration, integration, and best practices.
Out of Scope Changes check ✅ Passed All changes are directly in-scope: a new graceful shutdown documentation page and sidebar entry matching the stated objective to document GracefulShutdown configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@site-new/src/content/docs/server/graceful-shutdown.mdx`:
- Around line 27-40: The Java examples calling HttpResponse.of("OK") are missing
the import for com.linecorp.armeria.common.HttpResponse; update the examples
(the snippets that build Server/ServerBuilder and call HttpResponse.of) to
include the import statement for HttpResponse alongside the existing imports so
the code is copy-paste runnable and references the HttpResponse class used by
ServerBuilder/Server.
- Line 25: Update the incomplete link syntax for the ServerBuilder references:
replace the occurrences of "(type)" used after "ServerBuilder" with the full
scheme format used elsewhere, i.e. "(type://serverbuilder)" so the API link
matches the existing "(type://...)" pattern and points to the ServerBuilder type
consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cfed2bd-a420-4eed-b47a-945ca282e608

📥 Commits

Reviewing files that changed from the base of the PR and between 339b5dd and 7432a13.

📒 Files selected for processing (2)
  • site-new/sidebars.ts
  • site-new/src/content/docs/server/graceful-shutdown.mdx

Copy link
Copy Markdown
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

Overall looks good 👍 👍

Comment on lines +11 to +13
1. **Quiet period** - The server waits until there are no pending responses and no active
blocking tasks. Once this idle state persists for the configured quiet period duration,
the server proceeds to shut down.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit; in terms of wording, what do you think of the following which gives more context on the purpose of quiet period?

Suggested change
1. **Quiet period** - The server waits until there are no pending responses and no active
blocking tasks. Once this idle state persists for the configured quiet period duration,
the server proceeds to shut down.
1. **Quiet period** - When shutdown begins, the server stops passing health checks and enters a quiet period. During this period, existing requests and blocking tasks are allowed to complete, and clients can observe that the server is no longer healthy. After the configured quiet period has passed since the last running request completed, the server proceeds with shutdown.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated the quiet period description to clarify the health check transition and the observation window before shutdown.

Comment on lines +109 to +115
:::tip

Even if `toExceptionFunction` throws an unexpected exception, the server will fall back to the
default `503 Service Unavailable` response. This ensures that a bug in your custom function
never breaks the shutdown process.

:::
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit) I prefer this is not in the documentation as I don't want to encourage users to throw an exception in the function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the tip. Agreed that it could read as encouraging exceptions from the function.

@jrhee17 jrhee17 added this to the 1.39.0 milestone Apr 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (8150425) to head (6bf6527).
⚠️ Report is 411 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #6713       +/-   ##
============================================
- Coverage     74.46%       0   -74.47%     
============================================
  Files          1963       0     -1963     
  Lines         82437       0    -82437     
  Branches      10764       0    -10764     
============================================
- Hits          61385       0    -61385     
+ Misses        15918       0    -15918     
+ Partials       5134       0     -5134     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Add documentation for GracefulShutdown

2 participants