Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/http2: several benchmarks crash #70338

Open
rittneje opened this issue Nov 14, 2024 · 2 comments
Open

x/net/http2: several benchmarks crash #70338

rittneje opened this issue Nov 14, 2024 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rittneje
Copy link

Go version

go version go1.22.8 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/tmp/.gocache'
GOENV='/Users/rittneje/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/rittneje/go/pkg/mod'
GONOPROXY='[REDACTED]'
GONOSUMDB='[REDACTED]'
GOOS='darwin'
GOPATH='/Users/rittneje/go'
GOPRIVATE='[REDACTED]'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/rittneje/go1.22.8'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/Users/rittneje/go1.22.8/pkg/tool/darwin_amd64'
GOVCS='[REDACTED]'
GOVERSION='go1.22.8'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/rittneje/golang.org_x_net/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/kf/kr7_s3xx0l12zbj3jrn082hmzy5gvy/T/go-build1111184570=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Tried to run any benchmark from golang.org/x/net/http2 that uses newServerTesterWithRealConn.

  1. BenchmarkServerGets
  2. BenchmarkServerPosts
  3. BenchmarkServerToClientStreamDefaultOptions
  4. BenchmarkServerToClientStreamReuseFrames
  5. BenchmarkServer_GetRequest
  6. BenchmarkServer_PostRequest

What did you see happen?

They all crash, because newServerTesterWithRealConn neglects to initialize the serverTester's group field.

$ go test -run=^$ -bench=BenchmarkServerGets ./http2
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http2
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd4c36c7]

goroutine 28 [running]:
golang.org/x/net/http2.(*synctestGroup).idle(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:84 +0x47
golang.org/x/net/http2.(*synctestGroup).Wait(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:75 +0x2f
golang.org/x/net/http2.(*serverTester).sync(...)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:336
golang.org/x/net/http2.(*serverTester).greetAndCheckSettings(0xc0001703c0, 0xd66f888)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:440 +0x85
golang.org/x/net/http2.(*serverTester).greet(0xc0001703c0)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:433 +0x35
golang.org/x/net/http2.BenchmarkServerGets(0xc000166c88)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:2884 +0xae
testing.(*B).runN(0xc000166c88, 0x1)
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:208 +0x90
exit status 2
FAIL    golang.org/x/net/http2  0.672s
FAIL
$ go test -run=^$ -bench=BenchmarkServerPosts ./http2
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http2
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkServerPosts-16         panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x18ea6c7]

goroutine 5 [running]:
golang.org/x/net/http2.(*synctestGroup).idle(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:84 +0x47
golang.org/x/net/http2.(*synctestGroup).Wait(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:75 +0x2f
golang.org/x/net/http2.(*serverTester).sync(...)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:336
golang.org/x/net/http2.(*serverTester).greetAndCheckSettings(0xc0001703c0, 0x1a96888)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:440 +0x85
golang.org/x/net/http2.(*serverTester).greet(0xc0001703c0)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:433 +0x35
golang.org/x/net/http2.BenchmarkServerPosts(0xc000166c88)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:2926 +0xeb
testing.(*B).runN(0xc000166c88, 0x1)
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:208 +0x90
exit status 2
FAIL    golang.org/x/net/http2  0.287s
FAIL
$ go test -run=^$ -bench=BenchmarkServer_GetRequest ./http2
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http2
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkServer_GetRequest-16           panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd58c6c7]

goroutine 12 [running]:
golang.org/x/net/http2.(*synctestGroup).idle(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:84 +0x47
golang.org/x/net/http2.(*synctestGroup).Wait(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:75 +0x2f
golang.org/x/net/http2.(*serverTester).sync(...)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:336
golang.org/x/net/http2.(*serverTester).greetAndCheckSettings(0xc0000f63c0, 0xd738888)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:440 +0x85
golang.org/x/net/http2.(*serverTester).greet(0xc0000f63c0)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:433 +0x35
golang.org/x/net/http2.BenchmarkServer_GetRequest(0xc0000eec88)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:3278 +0xeb
testing.(*B).runN(0xc0000eec88, 0x1)
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:208 +0x90
exit status 2
FAIL    golang.org/x/net/http2  0.300s
FAIL
$ go test -run=^$ -bench=BenchmarkServer_PostRequest ./http2
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http2
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkServer_PostRequest-16          panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5f4d6c7]

goroutine 26 [running]:
golang.org/x/net/http2.(*synctestGroup).idle(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:84 +0x47
golang.org/x/net/http2.(*synctestGroup).Wait(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:75 +0x2f
golang.org/x/net/http2.(*serverTester).sync(...)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:336
golang.org/x/net/http2.(*serverTester).greetAndCheckSettings(0xc0001703c0, 0x60f9888)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:440 +0x85
golang.org/x/net/http2.(*serverTester).greet(0xc0001703c0)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:433 +0x35
golang.org/x/net/http2.BenchmarkServer_PostRequest(0xc000166c88)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:3315 +0xeb
testing.(*B).runN(0xc000166c88, 0x1)
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:208 +0x90
exit status 2
FAIL    golang.org/x/net/http2  0.304s
FAIL
$ go test -run=^$ -bench=BenchmarkServerToClientStreamDefaultOptions ./http2
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http2
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkServerToClientStreamDefaultOptions-16          panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x228d6c7]

goroutine 50 [running]:
golang.org/x/net/http2.(*synctestGroup).idle(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:84 +0x47
golang.org/x/net/http2.(*synctestGroup).Wait(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:75 +0x2f
golang.org/x/net/http2.(*serverTester).sync(...)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:336
golang.org/x/net/http2.(*serverTester).greetAndCheckSettings(0xc0001e83c0, 0x2439888)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:440 +0x85
golang.org/x/net/http2.(*serverTester).greet(0xc0001e83c0)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:433 +0x35
golang.org/x/net/http2.benchmarkServerToClientStream(0xc0001dec88, {0x0, 0x0, 0x0})
        /Users/rittneje/golang.org_x_net/http2/server_test.go:2997 +0x11c
golang.org/x/net/http2.BenchmarkServerToClientStreamDefaultOptions(0xc0001dec88?)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:2958 +0x1a
testing.(*B).runN(0xc0001dec88, 0x1)
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:208 +0x90
exit status 2
FAIL    golang.org/x/net/http2  0.316s
FAIL
$ go test -run=^$ -bench=BenchmarkServerToClientStreamReuseFrames ./http2
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http2
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkServerToClientStreamReuseFrames-16     panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe1016c7]

goroutine 14 [running]:
golang.org/x/net/http2.(*synctestGroup).idle(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:84 +0x47
golang.org/x/net/http2.(*synctestGroup).Wait(0x0)
        /Users/rittneje/golang.org_x_net/http2/sync_test.go:75 +0x2f
golang.org/x/net/http2.(*serverTester).sync(...)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:336
golang.org/x/net/http2.(*serverTester).greetAndCheckSettings(0xc0000f63c0, 0xe2ad888)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:440 +0x85
golang.org/x/net/http2.(*serverTester).greet(0xc0000f63c0)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:433 +0x35
golang.org/x/net/http2.benchmarkServerToClientStream(0xc0000eec88, {0xc000093f30, 0x1, 0x1})
        /Users/rittneje/golang.org_x_net/http2/server_test.go:2997 +0x11c
golang.org/x/net/http2.BenchmarkServerToClientStreamReuseFrames(0xc0000eec88)
        /Users/rittneje/golang.org_x_net/http2/server_test.go:2964 +0x57
testing.(*B).runN(0xc0000eec88, 0x1)
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:193 +0xf8
testing.(*B).run1.func1()
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:215 +0x4e
created by testing.(*B).run1 in goroutine 1
        /Users/rittneje/go1.22.8/src/testing/benchmark.go:208 +0x90
exit status 2
FAIL    golang.org/x/net/http2  0.316s
FAIL

What did you expect to see?

They should all work, or be removed.

@cherrymui
Copy link
Member

cc @neild @tombergan

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 15, 2024
@cherrymui cherrymui added this to the Unreleased milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants