Skip to content

net/http: data race on countReader.n #4220

Closed
@dvyukov

Description

@dvyukov
14574:2c2052f38c3c

On net/http tests ThreadSanitizer says:

WARNING: DATA RACE at 0x000040784820
Write by goroutine 183:
  net/http_test.countReader.Read()
      src/pkg/net/http/serve_test.go:1070 +0x8c
  net/http_test.(*countReader).Read()
      src/pkg/net/http/client_test.go:0 +0xa2
  io.(*LimitedReader).Read()
      src/pkg/io/io.go:406 +0x161
  io/ioutil.(*nopCloser).Read()
      src/pkg/io/ioutil/blackhole_race.go:1 +0x5b
  io.(*multiReader).Read()
      src/pkg/io/multi.go:13 +0x94
  io.Copy()
      src/pkg/io/io.go:360 +0x1bd
  net/http.(*transferWriter).WriteBody()
      src/pkg/net/http/transfer.go:194 +0x1e0
  net/http.(*Request).write()
      src/pkg/net/http/request.go:371 +0xa77
  net/http.(*persistConn).writeLoop()
      src/pkg/net/http/transport.go:660 +0x227

Previous read by goroutine 99:
  net/http_test.TestRequestBodyLimit()
      src/pkg/net/http/serve_test.go:1102 +0x292
  testing.tRunner()
      src/pkg/testing/testing.go:301 +0x86

Goroutine 183 (running) created at:
  net/http.(*Transport).getConn()
      src/pkg/net/http/transport.go:408 +0x7d8
  net/http.(*Transport).RoundTrip()
      src/pkg/net/http/transport.go:157 +0x372
  net/http.send()
      src/pkg/net/http/client.go:141 +0x526
  net/http.(*Client).Do()
      src/pkg/net/http/client.go:109 +0x10d
  net/http_test.TestRequestBodyLimit()
      src/pkg/net/http/serve_test.go:1100 +0x280
  testing.tRunner()
      src/pkg/testing/testing.go:301 +0x86

Goroutine 99 (finished) created at:
  testing.RunTests()
      src/pkg/testing/testing.go:377 +0xa3e
  testing.Main()
      src/pkg/testing/testing.go:313 +0xad
  main.main()
      net/http/_test/_testmain.go:301 +0x95
  runtime.main()
      src/pkg/runtime/proc.c:247 +0x91

Not particularly harmful, but still.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions