mirror of
https://github.com/golang/go.git
synced 2025-12-28 06:34:04 +00:00
runtime: skip TestArenaCollision if we run out of hints
This seems failure mode seems to have become more common on Windows. I suspect the randomized heap base address has something to do with it, but I'm not 100% sure. What's definitely certain is that we're running out of hints, since we're seeing failures that mheap_.arenaHints is nil and GetNextArenaHint doesn't actually check that. At the very least we can check that and skip. We know that in this case there's not that much we can do. Fixes #76566. Change-Id: I8ccc8994806b6c95e3157eb296b09705637564b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/726527 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
fe4952f116
commit
96e142ba2b
@ -551,8 +551,11 @@ func MapNextArenaHint() (start, end uintptr, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetNextArenaHint() uintptr {
|
||||
return mheap_.arenaHints.addr
|
||||
func NextArenaHint() (uintptr, bool) {
|
||||
if mheap_.arenaHints == nil {
|
||||
return 0, false
|
||||
}
|
||||
return mheap_.arenaHints.addr, true
|
||||
}
|
||||
|
||||
type G = g
|
||||
|
||||
@ -664,10 +664,24 @@ func TestArenaCollision(t *testing.T) {
|
||||
}
|
||||
t.Logf("reserved [%#x, %#x)", start, end)
|
||||
disallowed = append(disallowed, [2]uintptr{start, end})
|
||||
|
||||
hint, ok := NextArenaHint()
|
||||
if !ok {
|
||||
// We're out of arena hints. There's not much we can do now except give up.
|
||||
// This might happen for a number of reasons, like if there's just something
|
||||
// else already mapped in the address space where we put our hints. This is
|
||||
// a bit more common than it used to be thanks to heap base randomization.
|
||||
t.Skip("ran out of arena hints")
|
||||
}
|
||||
|
||||
// Allocate until the runtime tries to use the hint we
|
||||
// just mapped over.
|
||||
hint := GetNextArenaHint()
|
||||
for GetNextArenaHint() == hint {
|
||||
for {
|
||||
if next, ok := NextArenaHint(); !ok {
|
||||
t.Skip("ran out of arena hints")
|
||||
} else if next != hint {
|
||||
break
|
||||
}
|
||||
ac := new(acLink)
|
||||
arenaCollisionSink = append(arenaCollisionSink, ac)
|
||||
// The allocation must not have fallen into
|
||||
|
||||
Loading…
Reference in New Issue
Block a user