Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: detect zombie goroutines #5308
Runtime can detect goroutines blocked on unreachable chans/mutexes/etc and report such cases. This needs an interface in http/pprof to query zombie goroutines on running services. And probably testing package integration to test for absence of zombie goroutines.
The idea is as follows: Do GC-like scan of memory, but do not consider stacks of goroutines blocked on channels as roots. If a channel is marked as reachable, make all goroutines blocked on it as reachable and include their stacks into roots. At the end of the scan goroutines not marked as reachable are reported as dead. This can be extended to other synchronization primitives and timers (timer which Time chan is not reachable other than from the timer is dead).
Status changed to Accepted.