-
Notifications
You must be signed in to change notification settings - Fork 18k
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
go/types: data races resulting from package mutation in NewChecker #61212
Comments
I'm seeing this flake with pretty high frequency as of yesterday, yet go/loader has not changed recently AFAIK. A change to the race detector, perhaps? |
Yeah, I had the same thought. But I can't reproduce it locally with 1.20, or tip, or tip from Jun 23. I just noticed that https://go.dev/cl/508437 is also failing in -race even though the change is benign. I've asked the runtime folks. |
Possibly related: https://go.dev/cl/505055 |
This is actually resulting from https://go.dev/cl/507975, where As @prattmic pointed out in chat, There are probably two bugs here: |
Well spotted. NewChecker should have an internal comment stating that it may be called with types.Unsafe, and that it should not mutate pkg until CheckFiles (which is never called for Unsafe). And CheckFiles should either return immediately or panic if pkg==Unsafe. |
Yes, I'll fix. |
Change https://go.dev/cl/508439 mentions this issue: |
Change https://go.dev/cl/508440 mentions this issue: |
Found new dashboard test flakes for:
2023-07-06 00:35 linux-arm64-race tools@e7916d01 go@b490bdc2 x/tools/go/loader.TestLoad2 (log)
2023-07-06 00:35 linux-arm64-race tools@e7916d01 go@b490bdc2 x/tools/go/loader.TestLoad1 (log)
2023-07-06 19:23 linux-amd64-longtest-race tools@83045326 go@6305d7fd x/tools/go/loader.TestLoad2 (log)
2023-07-06 19:23 linux-amd64-longtest-race tools@83045326 go@6305d7fd x/tools/go/loader.TestLoad1 (log)
2023-07-06 19:23 linux-amd64-race tools@83045326 go@449ef379 x/tools/go/loader.TestLoad1 (log)
2023-07-06 19:23 linux-amd64-race tools@83045326 go@449ef379 x/tools/go/loader.TestLoad2 (log)
2023-07-06 20:34 linux-amd64-longtest-race tools@124ebfa4 go@449ef379 x/tools/go/loader.TestLoad2 (log)
2023-07-06 20:34 linux-amd64-longtest-race tools@124ebfa4 go@449ef379 x/tools/go/loader.TestLoad1 (log)
2023-07-06 20:34 linux-amd64-race tools@124ebfa4 go@449ef379 x/tools/go/loader.TestLoad1 (log)
2023-07-06 20:34 linux-amd64-race tools@124ebfa4 go@449ef379 x/tools/go/loader.TestLoad2 (log)
2023-07-06 20:44 freebsd-amd64-race tools@eaca1d00 go@e6ec2a34 x/tools/go/loader.TestLoad2 (log)
2023-07-06 20:44 freebsd-amd64-race tools@eaca1d00 go@e6ec2a34 x/tools/go/loader.TestLoad1 (log)
2023-07-06 21:23 linux-amd64-longtest-race tools@4b177d0b go@e6ec2a34 x/tools/go/loader.TestLoad2 (log)
2023-07-06 21:23 linux-amd64-longtest-race tools@4b177d0b go@e6ec2a34 x/tools/go/loader.TestLoad1 (log)
2023-07-06 21:42 freebsd-amd64-race tools@dfb7d247 go@e6ec2a34 x/tools/go/loader.TestLoad1 (log)
2023-07-06 21:42 freebsd-amd64-race tools@dfb7d247 go@e6ec2a34 x/tools/go/loader.TestLoad2 (log)
2023-07-06 21:42 linux-amd64-longtest-race tools@dfb7d247 go@d3d78b4b x/tools/go/loader.TestLoad1 (log)
2023-07-06 21:42 linux-amd64-longtest-race tools@dfb7d247 go@d3d78b4b x/tools/go/loader.TestLoad2 (log)
2023-07-06 21:42 linux-amd64-longtest-race tools@dfb7d247 go@e6ec2a34 x/tools/go/loader.TestLoad1 (log)
2023-07-06 21:42 linux-amd64-longtest-race tools@dfb7d247 go@e6ec2a34 x/tools/go/loader.TestLoad2 (log)
2023-07-06 21:42 linux-amd64-race tools@dfb7d247 go@39c50707 x/tools/go/loader.TestLoad1 (log)
2023-07-06 21:42 linux-amd64-race tools@dfb7d247 go@39c50707 x/tools/go/loader.TestLoad2 (log)
2023-07-06 21:42 linux-arm64-race tools@dfb7d247 go@158d1119 x/tools/go/loader.TestLoad2 (log)
2023-07-06 21:42 linux-arm64-race tools@dfb7d247 go@158d1119 x/tools/go/loader.TestLoad1 (log)
|
CL 507975 resulted in new data races (as reported in golang#61212), because the pkg argument to NewChecker was mutated. Fix this by deferring the recording of the goVersion in pkg until type checking is actually initiated via a call to Checker.Files. Additionally, modify types2/check.go to bring it in sync with the changes in go/types/check.go, and generate the new version_test.go from the types2 file. Also move parsing the version into checkFiles, for simplicity. Fixes golang#61212 Change-Id: I15edb6c2cff3085622fe7c6a3b0dab531d27bd04 Reviewed-on: https://go-review.googlesource.com/c/go/+/508439 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
CL 507975 resulted in new data races (as reported in golang#61212), because the pkg argument to NewChecker was mutated. Fix this by deferring the recording of the goVersion in pkg until type checking is actually initiated via a call to Checker.Files. Additionally, modify types2/check.go to bring it in sync with the changes in go/types/check.go, and generate the new version_test.go from the types2 file. Also move parsing the version into checkFiles, for simplicity. Fixes golang#61212 Change-Id: I15edb6c2cff3085622fe7c6a3b0dab531d27bd04 Reviewed-on: https://go-review.googlesource.com/c/go/+/508439 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
https://storage.googleapis.com/go-build-log/449ef379/linux-amd64-race_bbcd4378.log
The text was updated successfully, but these errors were encountered: