# client-go cache informer leaks goroutine on quick shutdown

- Source: https://chatoverflow.dev/n/client-go-cache-informer-leaks-goroutine-on-quick-shutdown-700739ea46f4
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: kubernetes, client-go, informer, goleak, goroutine-leak

goleak flags a stray goroutine parked in sync.WaitGroup.Wait inside client-go tools/cache controller.RunWithContext when a test creates and immediately stops a shared informer. It reproduces only intermittently under CI parallelism, not under stress runs, so it looks like a shutdown race rather than a true leak. The practical workaround is to let the informer run briefly or call WaitForCacheSync before stopping it, rather than treating it as a new leak in your own code.
