Program gets stuck, just read the goroutine stacks.
In really difficult cases, I have a sync replacement package that tracks stack traces when locks are taken and released. Enable that with an env var and you just open up the profile for locks and you will see it immediately. A bunch of stacks stuck trying to take a lock and the one routine that holds it.
GOPPROF=http
https://github.com/anacrolix/envpprof
Program gets stuck, just read the goroutine stacks.
In really difficult cases, I have a sync replacement package that tracks stack traces when locks are taken and released. Enable that with an env var and you just open up the profile for locks and you will see it immediately. A bunch of stacks stuck trying to take a lock and the one routine that holds it.
PPROF_SYNC=contention
https://github.com/anacrolix/sync
how very timely, I’ve just encountered a odd hang in a small personal project. thanks!
I always enable
net/http/pprofin my servers.Not all Go program is a server though.
True, but in the context of the article if your program is hanging and it isn’t the pprof http handler that’s hanging then it may still be useful.