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

net/http: data race in TestWriteDeadlineEnforcedPerStream #62638

Closed
bcmills opened this issue Sep 14, 2023 · 3 comments
Closed

net/http: data race in TestWriteDeadlineEnforcedPerStream #62638

bcmills opened this issue Sep 14, 2023 · 3 comments
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Sep 14, 2023

What version of Go are you using (go version)?

~/go-review/src$ go version
go version devel go1.22-399b2a4b1b Wed Sep 13 21:00:43 2023 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
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-review'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/google/home/bcmills/go-review/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.22-399b2a4b1b Wed Sep 13 21:00:43 2023 +0000'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/usr/local/google/home/bcmills/go-review/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-build223747416=/tmp/go-build -gno-record-gcc-switches'

What did you do?

~/go-review/src$ while go test -race net net/http -count=1; do true; done

What did you expect to see?

Tests consistently passing.

What did you see instead?

==================
WARNING: DATA RACE
Read at 0x00c000014328 by goroutine 6799:
  net/http_test.testWriteDeadlineEnforcedPerStream.func1()
      /usr/local/google/home/bcmills/go-review/src/net/http/serve_test.go:866 +0x37
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:2159 +0x47
  net/http.serverHandler.ServeHTTP()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:2989 +0x2a1
  net/http.(*conn).serve()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:2032 +0xc24
  net/http.(*Server).Serve.gowrap3()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:3137 +0x4f

Previous write at 0x00c000014328 by goroutine 6791:
  net/http_test.testWriteDeadlineEnforcedPerStream.func1()
      /usr/local/google/home/bcmills/go-review/src/net/http/serve_test.go:866 +0x49
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:2159 +0x47
  net/http.serverHandler.ServeHTTP()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:2989 +0x2a1
  net/http.(*conn).serve()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:2032 +0xc24
  net/http.(*Server).Serve.gowrap3()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:3137 +0x4f

Goroutine 6799 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:3137 +0x80c
  net/http/httptest.(*Server).goServe.func1()
      /usr/local/google/home/bcmills/go-review/src/net/http/httptest/server.go:310 +0xa4

Goroutine 6791 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/google/home/bcmills/go-review/src/net/http/server.go:3137 +0x80c
  net/http/httptest.(*Server).goServe.func1()
      /usr/local/google/home/bcmills/go-review/src/net/http/httptest/server.go:310 +0xa4
==================
--- FAIL: TestWriteDeadlineEnforcedPerStream (0.66s)
    --- FAIL: TestWriteDeadlineEnforcedPerStream/h1 (0.51s)
        testing.go:1463: race detected during execution of test
    testing.go:1463: race detected during execution of test
FAIL
FAIL    net/http        42.095s

(attn @neild)

@bcmills bcmills added this to the Backlog milestone Sep 14, 2023
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 14, 2023
@bcmills
Copy link
Contributor Author

bcmills commented Sep 14, 2023

@bcmills
Copy link
Contributor Author

bcmills commented Sep 14, 2023

Hmm. Actually, that sleep should only happen for the second request, in which case there shouldn't be a third request for it to race with. 🤔

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure. labels Sep 14, 2023
@bcmills bcmills self-assigned this Sep 14, 2023
@bcmills bcmills modified the milestones: Backlog, Go1.22 Sep 14, 2023
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 14, 2023
@gopherbot
Copy link

Change https://go.dev/cl/528475 mentions this issue: net/http: syncronize tests that use reqNum counters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

2 participants