Commit ab592357 authored by Austin Clements's avatar Austin Clements

runtime: consistency check for G rescan position

Issue #17099 shows a failure that indicates we rescanned a stack twice
concurrently during mark termination, which suggests that the rescan
list became inconsistent. Add a simple check when we dequeue something
from the rescan list that it claims to be at the index where we found
it.

Change-Id: I6a267da4154a2e7b7d430cb4056e6bae978eaf62
Reviewed-on: https://go-review.googlesource.com/29280
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 39ce6eb9
...@@ -199,6 +199,11 @@ func markroot(gcw *gcWork, i uint32) { ...@@ -199,6 +199,11 @@ func markroot(gcw *gcWork, i uint32) {
gp = allgs[i-baseStacks] gp = allgs[i-baseStacks]
} else if baseRescan <= i && i < end { } else if baseRescan <= i && i < end {
gp = work.rescan.list[i-baseRescan].ptr() gp = work.rescan.list[i-baseRescan].ptr()
if gp.gcRescan != int32(i-baseRescan) {
// Looking for issue #17099.
println("runtime: gp", gp, "found at rescan index", i-baseRescan, "but should be at", gp.gcRescan)
throw("bad g rescan index")
}
} else { } else {
throw("markroot: bad index") throw("markroot: bad index")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment