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, syscall: a race condition caused by syscall.SocketDisableIPv6 #7687

Closed
mikioh opened this issue Apr 2, 2014 · 7 comments
Closed

net, syscall: a race condition caused by syscall.SocketDisableIPv6 #7687

mikioh opened this issue Apr 2, 2014 · 7 comments
Milestone

Comments

@mikioh
Copy link
Contributor

mikioh commented Apr 2, 2014

Sigh, at this point using syscall.SocketDisableIPv6 is completely pointless.

==================
WARNING: DATA RACE
Write by goroutine 408:
  net.TestDialGoogleIPv4()
      /home/mikioh/go/src/pkg/net/dialgoogle_test.go:149 +0x8e8
  testing.tRunner()
      /home/mikioh/go/src/pkg/testing/testing.go:422 +0x10f

Previous read by goroutine 400:
  syscall.Socket()
      /home/mikioh/go/src/pkg/syscall/syscall_unix.go:274 +0x67
  net.sysSocket()
      /home/mikioh/go/src/pkg/net/sys_cloexec.go:19 +0x6b
  net.socket()
      /home/mikioh/go/src/pkg/net/sock_posix.go:40 +0x91
  net.internetSocket()
      /home/mikioh/go/src/pkg/net/ipsock_posix.go:137 +0x189
  net.dialTCP()
      /home/mikioh/go/src/pkg/net/tcpsock_posix.go:155 +0x117
  net.dialSingle()
      /home/mikioh/go/src/pkg/net/dial.go:238 +0x42e
  net.func·020()
      /home/mikioh/go/src/pkg/net/dial.go:200 +0x12e

Goroutine 408 (running) created at:
  testing.RunTests()
      /home/mikioh/go/src/pkg/testing/testing.go:503 +0xb32
  testing.Main()
      /home/mikioh/go/src/pkg/testing/testing.go:435 +0xba
  main.main()
      /var/folders/7d/d3y9vsls2yd880k121jmzcyr0000gn/T/go-build643325068/net/_test/_testmain.go:333 +0xdc

Goroutine 400 (finished) created at:
  net.dialMulti()
      /home/mikioh/go/src/pkg/net/dial.go:210 +0x326
  net.func·019()
      /home/mikioh/go/src/pkg/net/dial.go:168 +0x176
  net.dial()
      /home/mikioh/go/src/pkg/net/fd_unix.go:40 +0x82
  net.(*Dialer).Dial()
      /home/mikioh/go/src/pkg/net/dial.go:171 +0x594
  net.TestDialDualStackLocalhost()
      /home/mikioh/go/src/pkg/net/dial_test.go:546 +0x601
  testing.tRunner()
      /home/mikioh/go/src/pkg/testing/testing.go:422 +0x10f
==================
@dvyukov
Copy link
Member

dvyukov commented Apr 2, 2014

Comment 1:

Labels changed: added threadsanitizer.

@rsc
Copy link
Contributor

rsc commented May 21, 2014

Comment 2:

Labels changed: added release-go1.4.

Status changed to Accepted.

@gopherbot
Copy link

Comment 3:

CL https://golang.org/cl/108930044 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 4:

I don't understand the race here. Presumably TestDialDualStackLocahost runs and
completes before TestDialGoogleIPv4 starts. Why is the read during
TestDialDualStackLocahost not seen as happening before the write in TestDialGoogleIPv4?
Is TestDialDualStackLocahost leaving a background goroutine running that it should not?

@mikioh
Copy link
Contributor Author

mikioh commented Sep 17, 2014

Comment 5:

TestDialDualStackLocahost uses net.Dialer{DualStack: true} so that it tests ipv4-only,
ipv6-only and dual ipv{4,6} cases, and it leaves the looser dial goroutine until the
kernel gives up to attempt 3-way handshaking. Would you prefer to introduce
syscall.Connect cancelleration stuff in go1.5? Though I`m wondering why we still need
syscall.SocketDisableIPv6.

@rsc
Copy link
Contributor

rsc commented Sep 18, 2014

Comment 6:

We have syscall.SocketDisableIPv6 so that we can test the IPv4 code paths even on
machines that would use IPv6 instead.

@rsc
Copy link
Contributor

rsc commented Oct 15, 2014

Comment 7:

Too late for changes.

Labels changed: added release-none, removed release-go1.4.

@mikioh mikioh closed this as completed in 21ed40c Apr 3, 2015
@mikioh mikioh added this to the Go1.5 milestone Apr 5, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
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

4 participants