Skip to content

runtime: track time or counts goroutine entered runtime #6809

@bradfitz

Description

@bradfitz
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions