Shutdown: log an undrained Shutdown and let a second signal kill the process #57

Open
opened 2026-10-03 19:13:13 +00:00 by mathias · 0 comments
Owner

From the adversarial review of PR #55 (finding 7, low). serveHTTP (cmd/tapir/shutdown.go) discards the error from Shutdown(shutdownCtx), so a drain that hit its 10 s grace leaves no log line; and signal.NotifyContext's stop() only runs at exit, so a second SIGTERM/SIGINT during the grace period is swallowed (an operator pressing Ctrl-C twice cannot force a quit). Fix: log the Shutdown error with the server address; after the first signal call stop() (restoring default handling) so a second one terminates. Red tests: a handler that outlives the grace produces a warn line; a second signal ends the process. Milestone v0.32.0, risk/low.


Created via git-mcp on behalf of @mathias

From the adversarial review of PR #55 (finding 7, low). `serveHTTP` (`cmd/tapir/shutdown.go`) discards the error from `Shutdown(shutdownCtx)`, so a drain that hit its 10 s grace leaves no log line; and `signal.NotifyContext`'s `stop()` only runs at exit, so a second SIGTERM/SIGINT during the grace period is swallowed (an operator pressing Ctrl-C twice cannot force a quit). Fix: log the Shutdown error with the server address; after the first signal call `stop()` (restoring default handling) so a second one terminates. Red tests: a handler that outlives the grace produces a warn line; a second signal ends the process. Milestone v0.32.0, risk/low. --- _Created via git-mcp on behalf of @mathias_
mathias added this to the v0.32.0 - audio upload follow-ups milestone 2026-10-03 19:13:13 +00:00
mathias added the risk/lowsize/stype/fix labels 2026-10-03 19:13:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/tapir#57