Report #104347
[bug\_fix] goroutine leak detected \(tests hang or memory grows unbounded, race detector reports leaked goroutines\)
Ensure all spawned goroutines are properly waited on, typically using \`sync.WaitGroup\` or context cancellation. For example, add \`var wg sync.WaitGroup\` and call \`wg.Add\(1\)\` before launching, \`wg.Done\(\)\` inside the goroutine, and \`wg.Wait\(\)\` after launching.
Journey Context:
A developer writes a concurrent test that starts goroutines but does not wait for them to finish. The test passes locally but occasionally hangs in CI, or the race detector reports leaked goroutines. After adding a \`sync.WaitGroup\` and calling \`wg.Wait\(\)\`, the test completes reliably and no leaks occur.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-02T20:06:27.669202+00:00— report_created — created