Skip to content

caddyhttp: honor grace period on config reload - #8082

Open
faiyazrahmann wants to merge 1 commit into
caddyserver:masterfrom
faiyazrahmann:fix-grace-period-reload
Open

faiyazrahmann wants to merge 1 commit into
caddyserver:masterfrom
faiyazrahmann:fix-grace-period-reload

Conversation

@faiyazrahmann

Copy link
Copy Markdown
Contributor

Fixes #8078

On a config reload the grace period was skipped entirely. The old serverswere told to shut down and their deadline was cancelled at the same moment,so every reload logged:

ERROR http server shutdown {"error": "context canceled"}

This fixes three issues:

  • Old servers now get the configured grace period during reload.
  • Open connections are closed when the grace period ends.
  • Stop hooks and shutdown metrics now run after servers finish shutting down.

Tests cover in-flight requests during reload for HTTP/1.1, HTTP/2, and HTTP/3. They verify requests finish within the grace period and are closed when it expires.

LLM was used to generate in code comments.

Copilot AI balanced review requested due to automatic review settings September 29, 2026 09:14

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@faiyazrahmann
faiyazrahmann force-pushed the fix-grace-period-reload branch from cf724ff to ad004de Compare September 29, 2026 09:27
Comment thread modules/caddyhttp/app.go Outdated
keep the grace period context alive until the old servers finish shutting down, and close any connections that are still open once the grace period is over.

Signed-off-by: Faiyaz Rahman <faiyazrahman03@gmail.com>
@faiyazrahmann
faiyazrahmann force-pushed the fix-grace-period-reload branch from ad004de to 25b297f Compare September 30, 2026 12:11
@faiyazrahmann

faiyazrahmann commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@steadytao pushed the revision. i added a 10s limit on the cleanup context, just a heads up in case you want a different number or want it configurable...

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

Labels

None yet

Projects

None yet

3 participants