-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types: data race in Checker.underlying #34921
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
Comments
The same CL also introduced a similar race in validType. Again from #31749:
|
This matches up with what I've been seeing. Before CL 196338 it was okay to concurrently type-check two packages that depend on the same package, which golang.org/x/tools/go/packages does, but not after. I've been running into the second (validType) race consistently. |
Fixed by https://golang.org/cl/201838 (but the CL mentioned #31749 by mistake). |
CL 196338, fixing #34333, introduced a data race by caching the result in n.underlying without protecting n with a lock.
Previously, if you had packages A and B both importing C, it was safe to run types.NewChecker(...).Files() on package C's files and then type-check A and B in parallel goroutines both of which returned C's type-check information from their types.Config.Importer.
But now both A and B might end up calling underlying or Underlying on the same type, and the writes updating the new cached value race. For example, here is one trace from #31749:
The text was updated successfully, but these errors were encountered: