golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
121.81k stars 17.42k forks source link

runtime: detect zombie goroutines #5308

Open dvyukov opened 11 years ago

dvyukov commented 11 years ago
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.
rsc commented 11 years ago

Comment 1:

Sounds halting problem-esque to me.

Status changed to Invalid.

dvyukov commented 11 years ago

Comment 2:

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.

rsc commented 10 years ago

Comment 3:

Labels changed: added repo-main.

rsc commented 10 years ago

Comment 4:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.