Skip to content

x/net/http2: data race in TestIssue20704Race #32841

@bcmills

Description

@bcmills

A flake observed in golang.org/x/net/http2 on the freebsd-amd64-race builder.

From the name of the test, I'm guessing it's intended to detect and prevent exactly the race in question, so there is probably a serious bug or regression here.

https://build.golang.org/log/e64159dc443157fafd5d63551f3478b309a5f4c0

==================
WARNING: DATA RACE
Write at 0x00c0002e6000 by goroutine 87:
  runtime.slicecopy()
      /tmp/workdir/go/src/runtime/slice.go:197 +0x0
  bufio.(*Writer).Write()
      /tmp/workdir/go/src/bufio/bufio.go:637 +0x3de
  golang.org/x/net/http2.(*responseWriter).write()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:2654 +0x1e0
  golang.org/x/net/http2.(*responseWriter).Write()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:2628 +0x70
  golang.org/x/net/http2.TestIssue20704Race.func1()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server_test.go:3727 +0x98
  net/http.HandlerFunc.ServeHTTP()
      /tmp/workdir/go/src/net/http/server.go:2007 +0x51
  net/http.serverHandler.ServeHTTP()
      /tmp/workdir/go/src/net/http/server.go:2802 +0xce
  net/http.initNPNRequest.ServeHTTP()
      /tmp/workdir/go/src/net/http/server.go:3374 +0xfc
  net/http.(*initNPNRequest).ServeHTTP()
      <autogenerated>:1 +0xa6
  net/http.Handler.ServeHTTP-fm()
      /tmp/workdir/go/src/net/http/server.go:86 +0x64
  golang.org/x/net/http2.(*serverConn).runHandler()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:2119 +0xac

Previous read at 0x00c0002e6000 by goroutine 126:
  runtime.slicecopy()
      /tmp/workdir/go/src/runtime/slice.go:197 +0x0
  golang.org/x/net/http2.(*Framer).WriteDataPadded()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/frame.go:683 +0x34d
  golang.org/x/net/http2.(*writeData).writeFrame()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/frame.go:643 +0x11d
  golang.org/x/net/http2.(*serverConn).writeFrameAsync()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:765 +0x58

Goroutine 87 (running) created at:
  golang.org/x/net/http2.(*serverConn).processHeaders()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:1853 +0x90f
  golang.org/x/net/http2.(*serverConn).processFrame()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:1384 +0x40d
  golang.org/x/net/http2.(*serverConn).processFrameFromReader()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:1342 +0x7ad
  golang.org/x/net/http2.(*serverConn).serve()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:860 +0x12c1
  golang.org/x/net/http2.(*Server).ServeConn()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:462 +0xda2
  golang.org/x/net/http2.ConfigureServer.func1()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:288 +0x117
  net/http.(*conn).serve()
      /tmp/workdir/go/src/net/http/server.go:1800 +0x1d35

Goroutine 126 (running) created at:
  golang.org/x/net/http2.(*serverConn).startFrameWrite()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:1143 +0x365
  golang.org/x/net/http2.(*serverConn).scheduleFrameWrite()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:1244 +0x371
  golang.org/x/net/http2.(*serverConn).wroteFrame()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:1205 +0x1dd
  golang.org/x/net/http2.(*serverConn).serve()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:858 +0x13ce
  golang.org/x/net/http2.(*Server).ServeConn()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:462 +0xda2
  golang.org/x/net/http2.ConfigureServer.func1()
      /tmp/workdir/gopath/src/golang.org/x/net/http2/server.go:288 +0x117
  net/http.(*conn).serve()
      /tmp/workdir/go/src/net/http/server.go:1800 +0x1d35
==================
--- FAIL: TestIssue20704Race (4.35s)
    testing.go:853: race detected during execution of test
FAIL
FAIL	golang.org/x/net/http2	23.036s

CC @bradfitz @tombergan

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions