Closed
Description
#!watchflakes
post <- goarch == "wasm" && pkg == "golang.org/x/net/http2" && test == "TestServer_Push_RejectAfterGoAway" && `timeout`
Go version
go version devel go1.23-1653833811 Fri Jan 19 19:23:40 2024 +0000 linux/amd64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/bcmills/.cache/go-build'
GOENV='/usr/local/google/home/bcmills/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr/local/google/home/bcmills/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/usr/local/google/home/bcmills'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/google/home/bcmills/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/google/home/bcmills/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-1653833811 Fri Jan 19 19:23:40 2024 +0000'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/usr/local/google/home/bcmills/go/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1312466808=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Add the following test to the time
package:
func TestAfterFuncStarvation(t *testing.T) {
var (
wg sync.WaitGroup
stop atomic.Bool
c = make(chan bool, 1)
)
wg.Add(2)
go func() {
for !stop.Load() {
c <- true
}
close(c)
wg.Done()
}()
go func() {
for range c {}
wg.Done()
}()
AfterFunc(1 * Microsecond, func() { stop.Store(true) })
wg.Wait()
}
Then run it using:
GOARCH=wasm GOOS=wasip1 go test time -run=TestAfterFuncStarvation -count=10000
What did you see happen?
~/go/src$ GOARCH=wasm GOOS=wasip1 go test time -run=TestAfterFuncStarvation -count=10000
panic: test timed out after 10m0s
running tests:
TestAfterFuncStarvation (9m56s)
goroutine 13835 [running]:
testing.(*M).startAlarm.func1()
/usr/local/google/home/bcmills/go/src/testing/testing.go:2366 +0x44
created by time.goFunc
/usr/local/google/home/bcmills/go/src/time/sleep.go:177 +0x5
goroutine 1 [chan receive]:
testing.(*T).Run(0x178b040, {0x6a007, 0x13}, 0xde460)
/usr/local/google/home/bcmills/go/src/testing/testing.go:1750 +0x44
testing.runTests.func1(0x178b040)
/usr/local/google/home/bcmills/go/src/testing/testing.go:2161 +0x3
testing.tRunner(0x178b040, 0x1499c80)
/usr/local/google/home/bcmills/go/src/testing/testing.go:1689 +0xd
testing.runTests(0x140a2a0, {0x37c140, 0x7f, 0x7f}, {0xc162d83908280698, 0x8bb3084da4, 0x37faa0})
/usr/local/google/home/bcmills/go/src/testing/testing.go:2159 +0x49
testing.(*M).Run(0x144e140)
/usr/local/google/home/bcmills/go/src/testing/testing.go:2027 +0x6e
main.main()
_testmain.go:445 +0x9
goroutine 13833 [runnable]:
time_test.TestAfterFuncStarvation.func2()
/usr/local/google/home/bcmills/go/src/time/sleep_test.go:102 +0x4
created by time_test.TestAfterFuncStarvation in goroutine 13831
/usr/local/google/home/bcmills/go/src/time/sleep_test.go:101 +0xd
goroutine 13831 [semacquire, 9 minutes]:
sync.runtime_Semacquire(0x1790198)
/usr/local/google/home/bcmills/go/src/runtime/sema.go:62 +0x2
sync.(*WaitGroup).Wait(0x1790190)
/usr/local/google/home/bcmills/go/src/sync/waitgroup.go:116 +0xf
time_test.TestAfterFuncStarvation(0x178b1e0)
/usr/local/google/home/bcmills/go/src/time/sleep_test.go:107 +0x12
testing.tRunner(0x178b1e0, 0xde460)
/usr/local/google/home/bcmills/go/src/testing/testing.go:1689 +0xd
created by testing.(*T).Run in goroutine 1
/usr/local/google/home/bcmills/go/src/testing/testing.go:1742 +0x43
goroutine 13832 [chan send]:
time_test.TestAfterFuncStarvation.func1()
/usr/local/google/home/bcmills/go/src/time/sleep_test.go:96 +0x3
created by time_test.TestAfterFuncStarvation in goroutine 13831
/usr/local/google/home/bcmills/go/src/time/sleep_test.go:94 +0x9
goroutine 13834 [runnable]:
time_test.TestAfterFuncStarvation.func3()
/usr/local/google/home/bcmills/go/src/time/sleep_test.go:106
created by time.goFunc
/usr/local/google/home/bcmills/go/src/time/sleep.go:177 +0x5
FAIL time 600.293s
FAIL
What did you expect to see?
The test completes 1000 iterations on wasip1/wasm
in about 1.2 seconds on my machine, so 10000 iterations should only take ~12 seconds:
~/go/src$ GOARCH=wasm GOOS=wasip1 go test time -run=TestAfterFuncStarvation -count=1000
ok time 1.228s
Running native code on linux/amd64
is much faster still, but that's to be expected:
go test time -run=TestAfterFuncStarvation -count=10000
ok time 0.587s
(attn @golang/wasm)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Status
Done