-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
For debugging goroutine leaks, it would be nice if the runtime could tell me how long each goroutine had been stuck in its current state. e.g. a goroutine blocked on a lock or channel send/recv for hours is probably busted. Could that timestamp be kept per-G? It's not much more memory. The time need not be perfectly accurate, either (if getting time every entry into runtime is viewed as too expensive), since the point I at least care about is just seeing very old things. Alternatively, all of this could be done in my own program (polling every ~30 seconds) if I had a per-G unique value that changed whenever the goroutine state changed. A per-G counter would be enough, incremented every entry to the runtime.