aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/traceback.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-02-21 10:55:32 -0800
committerGopher Robot <gobot@golang.org>2025-05-07 11:43:43 -0700
commit86101b083ad14bb0c6ca9c55d2869cba57760046 (patch)
treef4cb84ed0de02c1005004a01a264fcc9b8f732ce /src/runtime/traceback.go
parentab2a92dd84aa4d0e12e7a6ef929aee765dd2aa8d (diff)
downloadgo-86101b083ad14bb0c6ca9c55d2869cba57760046.tar.xz
runtime: print stack traces for bubbled goroutines on synctest deadlock
When synctest.Run panics due to every goroutine in the bubble being blocked, print a stack trace for every goroutine in the bubble. For #67434 Change-Id: Ie751c2ee6fa136930b18f4bee0277ff30da46905 Reviewed-on: https://go-review.googlesource.com/c/go/+/645719 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/traceback.go')
-rw-r--r--src/runtime/traceback.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 2ba05395d2..1390e8b1bd 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -1261,6 +1261,10 @@ func goroutineheader(gp *g) {
}
func tracebackothers(me *g) {
+ tracebacksomeothers(me, func(*g) bool { return true })
+}
+
+func tracebacksomeothers(me *g, showf func(*g) bool) {
level, _, _ := gotraceback()
// Show the current goroutine first, if we haven't already.
@@ -1279,7 +1283,7 @@ func tracebackothers(me *g) {
// against concurrent creation of new Gs, but even with allglock we may
// miss Gs created after this loop.
forEachGRace(func(gp *g) {
- if gp == me || gp == curgp || readgstatus(gp) == _Gdead || isSystemGoroutine(gp, false) && level < 2 {
+ if gp == me || gp == curgp || readgstatus(gp) == _Gdead || !showf(gp) || (isSystemGoroutine(gp, false) && level < 2) {
return
}
print("\n")