Skip to content

x/net/http2: data race in TestGoroutineLock #75811

@AlexanderYastrebov

Description

@AlexanderYastrebov

Go version

go version go1.25.1 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/alexander/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/alexander/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/dd/7b4mqcf91sn1kw0xrq40b13c0000gn/T/go-build3550978080=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/alexander/src/github.com/golang/net/go.mod'
GOMODCACHE='/Users/alexander/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/alexander/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/alexander/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

git log -1 --oneline
59706cd (HEAD -> master, tag: v0.45.0, origin/master, origin/HEAD) html: impose open element stack size limit

Running

while go test ./http2 -trimpath -race -count=10 ; do echo OK ; done

What did you see happen?

after a while fails with:

==================
WARNING: DATA RACE
Read at 0x000102f0454d by goroutine 68877:
  golang.org/x/net/http2.goroutineLock.checkNotOn()
      golang.org/x/net/http2/gotrack.go:52 +0x2c
  golang.org/x/net/http2.(*serverConn).sendServeMsg()
      golang.org/x/net/http2/server.go:1112 +0x68
  golang.org/x/net/http2.(*serverConn).runHandler.deferwrap1()
      golang.org/x/net/http2/server.go:2400 +0x24
  runtime.deferreturn()
      runtime/panic.go:589 +0x5c
  golang.org/x/net/http2.(*serverConn).scheduleHandler.gowrap1()
      golang.org/x/net/http2/server.go:2359 +0x50

Previous write at 0x000102f0454d by goroutine 72175:
  golang.org/x/net/http2.TestGoroutineLock.func1()
      golang.org/x/net/http2/gotrack_test.go:16 +0x30
  runtime.deferreturn()
      runtime/panic.go:589 +0x5c
  testing.tRunner()
      testing/testing.go:1934 +0x164
  testing.(*T).Run.gowrap1()
      testing/testing.go:1997 +0x3c

Goroutine 68877 (running) created at:
  golang.org/x/net/http2.(*serverConn).scheduleHandler()
      golang.org/x/net/http2/server.go:2359 +0x1c0
  golang.org/x/net/http2.(*serverConn).processHeaders()
      golang.org/x/net/http2/server.go:2116 +0x90c
  golang.org/x/net/http2.(*serverConn).processFrame()
      golang.org/x/net/http2/server.go:1609 +0x2c8
  golang.org/x/net/http2.(*serverConn).processFrameFromReader()
      golang.org/x/net/http2/server.go:1547 +0x260
  golang.org/x/net/http2.(*serverConn).serve()
      golang.org/x/net/http2/server.go:1003 +0x1100
  golang.org/x/net/http2.(*Server).serveConn()
      golang.org/x/net/http2/server.go:565 +0x133c
  golang.org/x/net/http2.(*Server).ServeConn()
      golang.org/x/net/http2/server.go:424 +0x160
  golang.org/x/net/http2.ConfigureServer.func2()
      golang.org/x/net/http2/server.go:321 +0xc8
  golang.org/x/net/http2.ConfigureServer.func3()
      golang.org/x/net/http2/server.go:329 +0x60
  net/http.(*conn).serve()
      net/http/server.go:1996 +0x1834
  net/http.(*Server).Serve.gowrap3()
      net/http/server.go:3493 +0x48

Goroutine 72175 (finished) created at:
  testing.(*T).Run()
      testing/testing.go:1997 +0x6e0
  testing.runTests.func1()
      testing/testing.go:2477 +0x74
  testing.tRunner()
      testing/testing.go:1934 +0x164
  testing.runTests()
      testing/testing.go:2475 +0x734
  testing.(*M).Run()
      testing/testing.go:2337 +0xaf4
  main.main()
      _testmain.go:875 +0x100
==================
--- FAIL: TestNoUnicodeStrings (0.21s)
    testing.go:1617: race detected during execution of test
FAIL
FAIL    golang.org/x/net/http2  35.427s

Note that it points to TestNoUnicodeStrings while race is in the TestGoroutineLock.

What did you expect to see?

No test failure.

This is potentially related to #66519 and https://go-review.googlesource.com/c/net/+/701836

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.TestingAn issue that has been verified to require only test changes, not just a test failure.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions