• Hyang-Ah (Hana) Kim's avatar
    cmd/trace: fix a runnable goroutine count bug · c24cc400
    Hyang-Ah (Hana) Kim authored
    When starting tracing, EvGoCreate events are added for existing
    goroutines that may have been blocking in syscall. EvGoCreate
    increments the runnable goroutine count. This change makes the
    following EvGoInSyscall event decrement the runnable goroutine count
    because we now know that goroutine is in syscall, and not runnable.
    
    Made generateTrace return an error, at any given time, the number
    of runnable/running/insyscall goroutines becomes non-negative.
    
    Added a basic test that checks the number of runnable/running
    goroutines don't include the goroutines in syscall - the test failed
    before this change.
    
    Change-Id: Ib732c382e7bd17158a437576f9d589ab89097ce6
    Reviewed-on: https://go-review.googlesource.com/25552
    Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
    c24cc400
trace.go 17.1 KB