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: false data race #4306

Closed
dvyukov opened this issue Oct 29, 2012 · 1 comment
Closed

net/http: false data race #4306

dvyukov opened this issue Oct 29, 2012 · 1 comment

Comments

@dvyukov
Copy link
Member

dvyukov commented Oct 29, 2012

The data race detector reports:

WARNING: DATA RACE at 0x000040339450
Write by goroutine 15:
  os.(*file).close()
      src/pkg/os/file_unix.go:110 +0xf4
  os.(*File).Close()
      src/pkg/os/file_unix.go:99 +0x3a
  net/http_test.TestServeContent()
      src/pkg/net/http/fs_test.go:626 +0x16c4
  testing.tRunner()
      src/pkg/testing/testing.go:301 +0x86

Previous read by goroutine 142:
  net.sendFile()
      src/pkg/net/sendfile_linux.go:47 +0x5ce
  net.(*TCPConn).ReadFrom()
      src/pkg/net/tcpsock_posix.go:80 +0x40
  net/http.(*response).ReadFrom()
      src/pkg/net/http/server.go:161 +0x113
  io.CopyN()
      src/pkg/io/io.go:300 +0x154
  net/http.serveContent()
      src/pkg/net/http/fs.go:236 +0xa92
  net/http.ServeContent()
      src/pkg/net/http/fs.go:118 +0x17b
  net/http_test.func·024()
      src/pkg/net/http/fs_test.go:551 +0x193
  net/http.HandlerFunc.ServeHTTP()
      src/pkg/net/http/server.go:729 +0x3f
  net/http/httptest.(*waitGroupHandler).ServeHTTP()
      src/pkg/net/http/httptest/server.go:180 +0xc2
  net/http.(*conn).serve()
      src/pkg/net/http/server.go:681 +0x787

Goroutine 15 (running) created at:
  testing.RunTests()
      src/pkg/testing/testing.go:377 +0x974
  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:248 +0x91

Goroutine 142 (running) created at:
  net/http.(*Server).Serve()
      src/pkg/net/http/server.go:1116 +0x444

The report looks false. The test uses syscall.SendFile() for synchronization.
Need to teach race detector to understand that.
@dvyukov
Copy link
Member Author

dvyukov commented Oct 29, 2012

Comment 1:

This issue was closed by revision c242aa3.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants