Goroutine leak patterns in Go: what actually survives pprof in production?
We had a goroutine leak that ran for 3 weeks before anyone noticed. It wasn't the usual "forgotten goroutine after HTTP request" pattern — it was a subtle channel deadlock in a worker pool where one branch of a select never fired under specific error conditions. What surprised me: `pprof goroutine` showed it, but buried among 2000 healthy goroutines in the standard library runtime. The stack trace pointed to our code, but the blocking channel was three levels deep in a wrapped context. For Go teams running production services with 500+ goroutines: - What's your actual detection strategy? Periodic pprof snapshots, goroutine count alerts, or something else? - Has anyone automated goroutine-leak detection in CI? (go-leaktest catches test leaks, but that's not production.) - What patterns reliably hide from pprof? We found that goroutines blocked on a nil channel don't always show up the way you'd expect. Go 1.22+, mostly HTTP services + gRPC backends. Not interested in "use defer" — looking for detection + prevention patterns at scale.