I wrote a web app using golang. When it's running in production, there are some goroutines blocked. Here are the information (generated by using pprof
):
goroutine 792247 [chan receive, 948 minutes]:
database/sql.(*Tx).awaitDone(0xc4206e2b80)
/usr/local/go/src/database/sql/sql.go:1440 +0x57
created by database/sql.(*DB).begin
/usr/local/go/src/database/sql/sql.go:1383 +0x274
The goroutine has been waiting on the channel for 948 minites. Apparently, there's something wrong. But the stack traces seems incomplete. It's not enough for me to find the bug. (I want some stack traces start from my program.)
How can I get the full stack traces of this goroutine? Or are there any other ways to debug this issue?
Update:
I've read the source code of database/sql/sql.go. It turns out database/sql/sql.go:1440
is in a new goroutine. The stack traces are incomplete
because previous stack traces belong to the parent
goroutine.
My question should be : are there better ways to debug this issue?