mirror of
https://github.com/golang/go
synced 2024-11-17 02:34:46 -07:00
runtime: disable trace v2 optimistic deadlock debugger
The v2 execution tracer has a rudimentary deadlock detector, but it's based on an arbitrary threshold that an actually get hit even if there's no deadlock. This ends up breaking tests sometimes, and it would be bad if this just appeared in production logs. Put this 'deadlock detector' behind a flag. For #55317. Change-Id: I286f0c05b3ac9600f4f2f9696065cac8bbd25f00 Reviewed-on: https://go-review.googlesource.com/c/go/+/544235 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
b6b72c775a
commit
74993bffe1
@ -443,6 +443,7 @@ func traceAdvance(stopTrace bool) {
|
||||
// held, we can be certain that when there are no writers there are
|
||||
// also no stale generation values left. Therefore, it's safe to flush
|
||||
// any buffers that remain in that generation's slot.
|
||||
const debugDeadlock = false
|
||||
systemstack(func() {
|
||||
// Track iterations for some rudimentary deadlock detection.
|
||||
i := 0
|
||||
@ -479,16 +480,18 @@ func traceAdvance(stopTrace bool) {
|
||||
osyield()
|
||||
}
|
||||
|
||||
// Try to detect a deadlock. We probably shouldn't loop here
|
||||
// this many times.
|
||||
if i > 100000 && !detectedDeadlock {
|
||||
detectedDeadlock = true
|
||||
println("runtime: failing to flush")
|
||||
for mp := mToFlush; mp != nil; mp = mp.trace.link {
|
||||
print("runtime: m=", mp.id, "\n")
|
||||
if debugDeadlock {
|
||||
// Try to detect a deadlock. We probably shouldn't loop here
|
||||
// this many times.
|
||||
if i > 100000 && !detectedDeadlock {
|
||||
detectedDeadlock = true
|
||||
println("runtime: failing to flush")
|
||||
for mp := mToFlush; mp != nil; mp = mp.trace.link {
|
||||
print("runtime: m=", mp.id, "\n")
|
||||
}
|
||||
}
|
||||
i++
|
||||
}
|
||||
i++
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user