Report #101979
[bug\_fix] goleak: Errors on successful test run: ... \(goroutine leak detected\)
Tie the goroutine's lifetime to a \`context.Context\` or a \`done\` channel. Use a \`select\` that includes \`case <-ctx.Done\(\): return\` before sending on a channel, so cancellation releases the goroutine instead of blocking forever.
Journey Context:
Your HTTP handler fans out backend queries in goroutines and sends results on an unbuffered channel. When the request times out, the handler returns to the client, but the worker goroutines still try to send on the channel and block forever because the receiver is gone. Memory usage climbs under load. You add \`go.uber.org/goleak\` to a test that exercises the timeout path and see leaked goroutines pinned on the channel send. You refactor the workers to accept the request \`context.Context\` and \`select\` between the send and \`ctx.Done\(\)\`, so the goroutine exits cleanly when the caller cancels.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:46:23.527625+00:00— report_created — created