3 ms·
One way I often debug this kind of problem is to use go's built-in pprof tooling. You can insert a profiling server into your program in four lines: https://pkg
by gnfargbl 5y ago
One way I often debug this kind of problem is to use go's built-in pprof tooling. You can insert a profiling server into your program in four lines: https://pkg.go.dev/net/http/pprof https://pkg.go.dev/net/http/pprof. Then, do something like
go tool pprof 'http://127.0.0.1:6060/debug/pprof/goroutine?debug=1'
to get a goroutine profile of your running program, and use the web command to display it in a browser as a DAG. The stuck goroutine can usually be seen pretty easily on the graph.