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

x/tools/go/loader: data race reported while running TestCycles #36415

Open
dmitshur opened this issue Jan 6, 2020 · 1 comment
Open

x/tools/go/loader: data race reported while running TestCycles #36415

dmitshur opened this issue Jan 6, 2020 · 1 comment

Comments

@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jan 6, 2020

From https://build.golang.org/log/1667c1c432e0389a87b0b5433d895b42eccd7716, which is a linux-amd64-race test run of golang/tools@774c71f using Go tip (1.14-ish):

[...]
==================
WARNING: DATA RACE
Read at 0x00c00713ff20 by goroutine 41:
  go/types.(*Package).Imports()
      /workdir/go/src/go/types/package.go:56 +0x2a1
  golang.org/x/tools/go/loader.markErrorFreePackages()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:686 +0x12f
  golang.org/x/tools/go/loader.(*Config).Load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:669 +0x1d31
  golang.org/x/tools/go/loader_test.TestCycles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader_test.go:744 +0xac2
  testing.tRunner()
      /workdir/go/src/testing/testing.go:954 +0x1eb

Previous write at 0x00c00713ff20 by goroutine 159:
  go/types.(*Checker).collectObjects()
      /workdir/go/src/go/types/resolver.go:264 +0x1c8a
  go/types.(*Checker).checkFiles()
      /workdir/go/src/go/types/check.go:255 +0xd7
  go/types.(*Checker).Files()
      /workdir/go/src/go/types/check.go:248 +0x2a2
  golang.org/x/tools/go/loader.(*importer).addFiles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:1030 +0x24c
  golang.org/x/tools/go/loader.(*importer).load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:989 +0x1f5
  golang.org/x/tools/go/loader.(*importer).startLoad.func1()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:970 +0x46

Goroutine 41 (running) created at:
  testing.(*T).Run()
      /workdir/go/src/testing/testing.go:1005 +0x660
  testing.runTests.func1()
      /workdir/go/src/testing/testing.go:1247 +0xa6
  testing.tRunner()
      /workdir/go/src/testing/testing.go:954 +0x1eb
  testing.runTests()
      /workdir/go/src/testing/testing.go:1245 +0x527
  testing.(*M).Run()
      /workdir/go/src/testing/testing.go:1162 +0x2ff
  golang.org/x/tools/go/loader_test.TestMain()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader_test.go:32 +0x3d
  main.main()
      _testmain.go:90 +0x223

Goroutine 159 (running) created at:
  golang.org/x/tools/go/loader.(*importer).startLoad()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:969 +0x2bb
  golang.org/x/tools/go/loader.(*importer).importAll()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:884 +0x327
  golang.org/x/tools/go/loader.(*importer).addFiles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:1014 +0x110
  golang.org/x/tools/go/loader.(*importer).load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:989 +0x1f5
  golang.org/x/tools/go/loader.(*importer).startLoad.func1()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:970 +0x46
==================
==================
WARNING: DATA RACE
Read at 0x00c004d53228 by goroutine 41:
  golang.org/x/tools/go/loader.markErrorFreePackages()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:686 +0x161
  golang.org/x/tools/go/loader.(*Config).Load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:669 +0x1d31
  golang.org/x/tools/go/loader_test.TestCycles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader_test.go:744 +0xac2
  testing.tRunner()
      /workdir/go/src/testing/testing.go:954 +0x1eb

Previous write at 0x00c004d53228 by goroutine 159:
  go/types.(*Checker).collectObjects()
      /workdir/go/src/go/types/resolver.go:264 +0x1c50
  go/types.(*Checker).checkFiles()
      /workdir/go/src/go/types/check.go:255 +0xd7
  go/types.(*Checker).Files()
      /workdir/go/src/go/types/check.go:248 +0x2a2
  golang.org/x/tools/go/loader.(*importer).addFiles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:1030 +0x24c
  golang.org/x/tools/go/loader.(*importer).load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:989 +0x1f5
  golang.org/x/tools/go/loader.(*importer).startLoad.func1()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:970 +0x46

Goroutine 41 (running) created at:
  testing.(*T).Run()
      /workdir/go/src/testing/testing.go:1005 +0x660
  testing.runTests.func1()
      /workdir/go/src/testing/testing.go:1247 +0xa6
  testing.tRunner()
      /workdir/go/src/testing/testing.go:954 +0x1eb
  testing.runTests()
      /workdir/go/src/testing/testing.go:1245 +0x527
  testing.(*M).Run()
      /workdir/go/src/testing/testing.go:1162 +0x2ff
  golang.org/x/tools/go/loader_test.TestMain()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader_test.go:32 +0x3d
  main.main()
      _testmain.go:90 +0x223

Goroutine 159 (running) created at:
  golang.org/x/tools/go/loader.(*importer).startLoad()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:969 +0x2bb
  golang.org/x/tools/go/loader.(*importer).importAll()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:884 +0x327
  golang.org/x/tools/go/loader.(*importer).addFiles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:1014 +0x110
  golang.org/x/tools/go/loader.(*importer).load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:989 +0x1f5
  golang.org/x/tools/go/loader.(*importer).startLoad.func1()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:970 +0x46
==================
--- FAIL: TestCycles (0.01s)
    testing.go:888: race detected during execution of test
==================
WARNING: DATA RACE
Write at 0x00c008825110 by goroutine 159:
  runtime.mapassign_faststr()
      /workdir/go/src/runtime/map_faststr.go:202 +0x0
  golang.org/x/tools/go/loader.(*importer).load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:992 +0x2c4
  golang.org/x/tools/go/loader.(*importer).startLoad.func1()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:970 +0x46

Previous read at 0x00c008825110 by goroutine 41:
  runtime.mapiterinit()
      /workdir/go/src/runtime/map.go:797 +0x0
  golang.org/x/tools/go/loader.(*Config).Load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:640 +0x1543
  golang.org/x/tools/go/loader_test.TestCycles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader_test.go:744 +0xac2
  testing.tRunner()
      /workdir/go/src/testing/testing.go:954 +0x1eb

Goroutine 159 (running) created at:
  golang.org/x/tools/go/loader.(*importer).startLoad()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:969 +0x2bb
  golang.org/x/tools/go/loader.(*importer).importAll()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:884 +0x327
  golang.org/x/tools/go/loader.(*importer).addFiles()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:1014 +0x110
  golang.org/x/tools/go/loader.(*importer).load()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:989 +0x1f5
  golang.org/x/tools/go/loader.(*importer).startLoad.func1()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader.go:970 +0x46

Goroutine 41 (finished) created at:
  testing.(*T).Run()
      /workdir/go/src/testing/testing.go:1005 +0x660
  testing.runTests.func1()
      /workdir/go/src/testing/testing.go:1247 +0xa6
  testing.tRunner()
      /workdir/go/src/testing/testing.go:954 +0x1eb
  testing.runTests()
      /workdir/go/src/testing/testing.go:1245 +0x527
  testing.(*M).Run()
      /workdir/go/src/testing/testing.go:1162 +0x2ff
  golang.org/x/tools/go/loader_test.TestMain()
      /workdir/gopath/src/golang.org/x/tools/go/loader/loader_test.go:32 +0x3d
  main.main()
      _testmain.go:90 +0x223
==================
[...]

/cc @matloob

@gopherbot gopherbot added this to the Unreleased milestone Jan 6, 2020
@matloob

This comment has been minimized.

Copy link
Contributor

@matloob matloob commented Jan 23, 2020

I'm able to reproduce this on linux/amd64 with tools at golang/tools@774c71f and go built from 82a2f82. But it's incredibly rare...

It doesn't show up with -count=1000 but does with -count=10000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.