What version of Go are you using (go version)?
1.9.2
GOOS=linux
GOARCH=amd64
What did you do?
package main
import (
"math/rand"
"strconv"
"testing"
"time"
)
func TestGoRoutines(t *testing.T) {
for i := 0; i < 1<<15; i++ {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
time.Sleep(time.Duration(rand.Intn(500000000)))
})
}
}
saved as x_test.go and run with go test -race
What did you expect to see?
The tests to pass. Instead,
race: limit on 8192 simultaneously alive goroutines is exceeded, dying
As I understand it, this is likely a technical limitation on Go's race detector. However, it would be nice for the testing package to be aware of this and, if raceenabled, cap the number of parallel tests at something below the 8192 limit (say, 7000?). Perhaps a better way would be a warning, but I know Go doesn't really like warnings.
What version of Go are you using (
go version)?1.9.2
GOOS=linux
GOARCH=amd64
What did you do?
saved as
x_test.goand run withgo test -raceWhat did you expect to see?
The tests to pass. Instead,
As I understand it, this is likely a technical limitation on Go's race detector. However, it would be nice for the
testingpackage to be aware of this and, if raceenabled, cap the number of parallel tests at something below the 8192 limit (say, 7000?). Perhaps a better way would be a warning, but I know Go doesn't really like warnings.