understanding go stack trace

1,979 views
Skip to first unread message

Ganesh Sangle

unread,
Sep 23, 2016, 2:05:35 PM9/23/16
to golang-nuts
I have a go process which has several go-routines, and these go-routines are suppose to run every few seconds.
If not, they print a message that they are not being scheduled as requested and abort the program.
For example, on go routine prints something, sleeps for two seconds, and repeats this loop - and it does not block or wait on any other part of program.

Now once it panics, it dumps a stack trace, which I am trying to understand - all help is appreciated here. I need to understand what the headers here indicate.
I tried to search documentation but couldnt find any - if you could point me to one that will be great as well.

Need to understand these
'X minutes' 
'locked to thread'
'force gc (idle'
'GC sweep wait'
'finalizer wait'
mark worker (idle)
Concurrent GC wait
runnable


goroutine 1 [chan receive, 8 minutes]:

goroutine 17 [syscall, 9 minutes, locked to thread]: - running a system call, what does '9 mins' mean ? Similarly, what does 'locked to thread' mean ?
goroutine 21 [syscall]:

goroutine 99 [select, 8 minutes]
goroutine 18 [select, 9 minutes, locked to thread]:

What is the difference in these two states ?
goroutine 20 [IO wait, 9 minutes] - wait for i/o, what does 9 minutes mean here ?
goroutine 29 [IO wait]


There are again a bunch of gc related go routines which I am trying to understand.

goroutine 2 [force gc (idle), 9 minutes]: 
goroutine 3 [GC sweep wait]:
goroutine 4 [finalizer wait, 2 minutes]
goroutine 88 [mark worker (idle), 9 minutes]




Dave Cheney

unread,
Sep 23, 2016, 5:59:28 PM9/23/16
to golang-nuts


On Saturday, 24 September 2016 04:05:35 UTC+10, Ganesh Sangle wrote:
I have a go process which has several go-routines, and these go-routines are suppose to run every few seconds.
If not, they print a message that they are not being scheduled as requested and abort the program.

How does that work ? If the goroutine has not been scheduled, how can it be scheduled to print out a message and exit ?
 
For example, on go routine prints something, sleeps for two seconds, and repeats this loop - and it does not block or wait on any other part of program.

Now once it panics, it dumps a stack trace, which I am trying to understand - all help is appreciated here. I need to understand what the headers here indicate.
I tried to search documentation but couldnt find any - if you could point me to one that will be great as well.

Need to understand these
'X minutes' 
'locked to thread'
'force gc (idle'
'GC sweep wait'
'finalizer wait'
mark worker (idle)
Concurrent GC wait
runnable


goroutine 1 [chan receive, 8 minutes]:

goroutine 17 [syscall, 9 minutes, locked to thread]: - running a system call, what does '9 mins' mean ? Similarly, what does 'locked to thread' mean ?

This goroutine is been performing a syscall, it stated 9 minutes ago, follow the stack trace for that goroutine to find out why. Locked to thread is due to this syscall being blocking, so an operating system thread is assigned to this goroutine for the duration of the syscall and a new one has been created to replace the loss of this one.
 
goroutine 21 [syscall]:

goroutine 99 [select, 8 minutes]
goroutine 18 [select, 9 minutes, locked to thread]:

Has something called runtime.LockOSThread()
 

What is the difference in these two states ?
goroutine 20 [IO wait, 9 minutes] - wait for i/o, what does 9 minutes mean here ?

All the durations refer to how long the goroutine has been blocked/sleeping/waiting.
Reply all
Reply to author
Forward
0 new messages