From 575cbb6887166d21b3de049d7a8284d528984a91 Mon Sep 17 00:00:00 2001 From: Ruslan Kosykh Date: Tue, 3 Nov 2026 21:40:44 +0200 Subject: [PATCH 1/2] fix(infra): keep servers up through the drain window 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 --- cmd/maintmode/main.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/maintmode/main.go b/cmd/maintmode/main.go index a50400c..739ef4e 100644 --- a/cmd/maintmode/main.go +++ b/cmd/maintmode/main.go @@ -214,8 +214,12 @@ func startAPIServer( ) s.BindRouters(cfg.Environment, meta) + // WithoutCancel: Echo shuts the server down as soon as the context passed to + // Start is canceled, and ctx is the signal context. Bound to it, the server + // would stop on SIGTERM, before the drain window lets the proxy eject this + // replica; it must keep serving until the closer calls Stop. go func() { - if err := s.Start(ctx); err != nil { + if err := s.Start(context.WithoutCancel(ctx)); err != nil { xlog.Fatal(ctx, "api server failed", xfield.Error(err)) } }() @@ -279,8 +283,11 @@ func startInfraServer( xhttpserver.WithLogger(xecho.NewSlogAdapter(logger)), ) + // WithoutCancel for the same reason as the API server, and it matters most + // here: /readiness has to stay up and answer 503 for the whole drain window, + // or the proxy sees a refused connection instead of a planned drain. go func() { - if err := s.Start(ctx); err != nil { + if err := s.Start(context.WithoutCancel(ctx)); err != nil { xlog.Fatal(ctx, "infra server failed", xfield.Error(err)) } }() From 59043f323ec87dc4980dcf2834e78d5086042aa7 Mon Sep 17 00:00:00 2001 From: Ruslan Kosykh Date: Tue, 3 Nov 2026 21:52:23 +0200 Subject: [PATCH 2/2] chore(deps): bump Go toolchain to go1.26.10 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 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index e261289..98f3bf9 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/ruko1202/maintmode go 1.26.0 -toolchain go1.26.9 +toolchain go1.26.10 require ( github.com/MicahParks/jwkset v0.11.4