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: data race in cfg.ch #10576

Closed
mikioh opened this issue Apr 25, 2015 · 4 comments
Closed

net: data race in cfg.ch #10576

mikioh opened this issue Apr 25, 2015 · 4 comments
Milestone

Comments

@mikioh
Copy link
Contributor

mikioh commented Apr 25, 2015

=== RUN TestReloadResolvConfFail
==================
WARNING: DATA RACE
Write by goroutine 91:
  net.loadConfig()
      /home/mikioh/go/src/net/dnsclient_unix.go:232 +0x91
  net.(*resolvConfTest).Start()
      /home/mikioh/go/src/net/dnsclient_unix_test.go:123 +0x85
  net.TestReloadResolvConfFail()
      /home/mikioh/go/src/net/dnsclient_unix_test.go:175 +0xe9
  testing.tRunner()
      /home/mikioh/go/src/testing/testing.go:452 +0xfc

Previous read by goroutine 65:
  net.loadConfig.func1()
      /home/mikioh/go/src/net/dnsclient_unix.go:246 +0x5f

Goroutine 91 (running) created at:
  testing.RunTests()
      /home/mikioh/go/src/testing/testing.go:560 +0xc9b
  testing.(*M).Run()
      /home/mikioh/go/src/testing/testing.go:490 +0xe7
  net.TestMain()
      /home/mikioh/go/src/net/main_test.go:44 +0x3f
  main.main()
      net/_test/_testmain.go:376 +0x28c

Goroutine 65 (running) created at:
  net.loadConfig()
      /home/mikioh/go/src/net/dnsclient_unix.go:270 +0x190
  net.loadDefaultConfig()
      /home/mikioh/go/src/net/dnsclient_unix.go:227 +0x58
  sync.(*Once).Do()
      /home/mikioh/go/src/sync/once.go:44 +0xfb
  net.lookup()
      /home/mikioh/go/src/net/dnsclient_unix.go:277 +0x272
  net.goLookupIPOrder.func1()
      /home/mikioh/go/src/net/dnsclient_unix.go:429 +0x5e
==================
@mikioh mikioh added this to the Go1.5 milestone Apr 25, 2015
@bradfitz
Copy link
Contributor

Haven't reviewed the CL, but maybe this is fixed by https://go-review.googlesource.com/9380

@axaxs
Copy link

axaxs commented Apr 26, 2015

This can only happen in testing. From what I can tell, this is caused by starting multiple instances of loadConfig during testing. The parameters do not allow for the refresh time nor the quit method to be changed or accessed from the outside. So if any lookup happens before these series of tests, it will be racy since all lookups call loadConfig.
I believe fixing this properly will require redoing the current implementation as I'd tried to sneak through.

I'll resubmit a full proper fix for this after fix for 10566 goes through, though it's still a rather big change.

@gopherbot
Copy link

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

@gopherbot
Copy link

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

@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

5 participants