Menu

1 / 2

Go's net/http Server.Shutdown: The Three-Stage Drain You Probably Skip

DEV Community·Gabriel Anhaia·6 months ago
#2DXPQ7VX
#stage#go#http#shutdown#context
Reading 0:00
15s threshold

Book: Hexagonal Architecture in Go

Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

A team I know had a clean shutdown story on paper. SIGTERM came

in, they called srv.Shutdown(ctx) , the function returned nil ,

the pod exited. Their dashboards said zero failed requests on

deploy. Their customers said otherwise.

Two things were happening that the textbook shutdown did not catch.

WebSocket connections from a long-poll feature stayed open through

the entire shutdown window because Shutdown does not interrupt

hijacked connections.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.