package main_test
import (
"runtime""testing"
)
var (
setGCPercentBallastinterface{}
setGCPercentSinkinterface{}
)
funcTestGC(t*testing.T) {
deferfunc() {
setGCPercentBallast=nilsetGCPercentSink=nilruntime.GC()
}()
runtime.GC()
varm1 runtime.MemStatsruntime.ReadMemStats(&m1)
// Create 50 MB of live heap as a baseline.constbaseline=50<<20setGCPercentBallast=make([]byte, baseline-m1.Alloc)
// Disable GOGC-based policy.// Set max heap to 2x baseline.constlimit=2*baseline// Allocate a bunch and check that we stay under the limit.runtime.ReadMemStats(&m1)
varm2 runtime.MemStatsfori:=0; i<200; i++ {
setGCPercentSink=make([]byte, 1<<20)
runtime.ReadMemStats(&m2)
ifm2.HeapAlloc>limit {
t.Logf("HeapAlloc %d exceeds heap limit %d\n", m2.HeapAlloc, limit)
}
}
ifm1.NumGC==m2.NumGC {
t.Fatalf("failed to trigger GC")
}
}
go test -c -o test_1.16
GODEBUG=gctrace=1 ./test_1.16 -test.count=10 -test.trace=16_trace_1 -test.run ^TestGC$
What did you expect to see?
What did you see instead?
Probably reproduce the following problems
In gcStart -> StopTheWorld -> finishsweep_m -> wakeScavenger
and runtime.bgscavenge is an runnable goroutine,
After StartTheWorkld, Proc1 cannot find it to execute in multiple proc start proc stop
It seems that findrunnable cannot find/steal this goroutine
go1.16.8
gomaster
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
I think it can, but the probability is lower
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
A test from https://go-review.googlesource.com/c/go/+/227767/3
go test -c -o test_1.16 GODEBUG=gctrace=1 ./test_1.16 -test.count=10 -test.trace=16_trace_1 -test.run ^TestGC$
What did you expect to see?
What did you see instead?
Probably reproduce the following problems



In gcStart -> StopTheWorld -> finishsweep_m -> wakeScavenger
and runtime.bgscavenge is an runnable goroutine,
After StartTheWorkld, Proc1 cannot find it to execute in multiple proc start proc stop
It seems that findrunnable cannot find/steal this goroutine
go1.16.8
gomaster
trace.zip
The text was updated successfully, but these errors were encountered: