Skip to content

fix(infra): keep servers up through the drain window - #36

Merged
ruko1202 merged 2 commits into
mainfrom
fix/drain-keeps-servers-up
Nov 3, 2026
Merged

ruko1202 merged 2 commits into
mainfrom
fix/drain-keeps-servers-up

Conversation

@ruko1202

@ruko1202 ruko1202 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Graceful drain did not work: on SIGTERM the API and infra ports closed immediately, so for the whole drain window (6s) the proxy saw a refused connection instead of /readiness 503, and in-flight requests were cut off before the drain had any effect.

Cause: Echo's StartConfig.Start(ctx, …) shuts the server down as soon as ctx is canceled, and both servers were started with the signal context from signal.NotifyContext. The xhttp Stop registered in the closer never got the chance to be the one that stops them.

Fix: start both servers on context.WithoutCancel(ctx). They now keep serving until closer.CloseAll calls Stop after the drain wait, which is the ordering shutdown() already documents.

Also: Go toolchain go1.26.9 → go1.26.10

The vulnerability scan started failing on every branch: govulncheck reports GO-2026-6809 (crypto/x509, fixed in go1.26.10) as reachable. The toolchain is pinned only in go.mod (CI reads it via go-version-file). govulncheck is clean on this branch after the bump.

Testing

Ran the binary locally and polled during shutdown:

before (main) after
/readiness during drain connection refused 503
/liveness during drain connection refused 204
API port during drain connection refused serving
after drain + CloseAll down down, clean exit

make lint: 0 issues. Rebased onto main after #35 was merged.

🤖 Generated with Claude Code

Echo's StartConfig.Start shuts the server down as soon as its context is
canceled, and both servers were started on the signal context. SIGTERM
therefore closed the API and infra ports immediately: for the whole drain
window the proxy saw refused connections instead of /readiness 503, and
in-flight requests were cut before the drain had any effect.

Start both servers on context.WithoutCancel(ctx) so they keep serving
until the closer calls Stop after the drain wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ruko1202
ruko1202 force-pushed the fix/drain-keeps-servers-up branch from 5d289bc to 575cbb6 Compare November 3, 2026 19:47
go1.26.10 fixes GO-2026-6809 (crypto/x509 distrusts compromised
intermediate certificates), which govulncheck reports as reachable and
which fails the vulnerability scan on every branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ruko1202
ruko1202 merged commit a293179 into main Nov 3, 2026
12 checks passed
@ruko1202
ruko1202 deleted the fix/drain-keeps-servers-up branch November 3, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant