Skip to content

net/http: data race in concurrent req.Body.{Close,Read} with 100-continue expected #30580

Open
@benburkert

Description

@benburkert

Please answer these questions before submitting your issue. Thanks!

What did you do?

https://gist.github.com/benburkert/76548cfac5aa6761fab2f88783b673aa

What did you expect to see?

No output.

What did you see instead?

==================
WARNING: DATA RACE
Read at 0x00c00000e3f8 by goroutine 9:
  net/http.(*expectContinueReader).Read()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:885 +0x42

Previous write at 0x00c00000e3f8 by goroutine 8:
  net/http.(*expectContinueReader).Close()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:901 +0x42

Goroutine 9 (running) created at:
  main.main.func1()
      /tmp/http.go:15 +0xef
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:1995 +0x51
  net/http.serverHandler.ServeHTTP()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:2774 +0xc4
  net/http.(*conn).serve()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:1878 +0x807

Goroutine 8 (running) created at:
  main.main.func1()
      /tmp/http.go:14 +0x70
  net/http.HandlerFunc.ServeHTTP()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:1995 +0x51
  net/http.serverHandler.ServeHTTP()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:2774 +0xc4
  net/http.(*conn).serve()
      /usr/local/Cellar/go/1.12/libexec/src/net/http/server.go:1878 +0x807
==================

System details

go version go1.12 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/benburkert/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/benburkert"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
GOROOT/bin/go version: go version go1.12 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.12
uname -v: Darwin Kernel Version 17.7.0: Thu Dec 20 21:47:19 PST 2018; root:xnu-4570.71.22~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G5019
lldb --version: lldb-1000.11.37.1
  Swift-4.2

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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions