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/gopls: race conditions result in confusing error message #34410
Comments
Change https://golang.org/cl/196537 mentions this issue: |
This change encodes an invariant that, a dependency package will only ever be parsed with trimmed ASTs. Updates golang/go#34410 Change-Id: I2ceab3672c0bae0b98cec2a8e60b92a0c01a900f Reviewed-on: https://go-review.googlesource.com/c/tools/+/196537 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
After investigating yesterday, the issue here seems to be that, with CL 186839, the deletion of an item from a map doesn't necessarily cause it to be garbage collected, so we may end up re-using an old cache entry when we wanted to force the type checker to recompute the entry. This will be fixed when we improve our cache invalidation strategy. |
I'm getting something that seems to be a race condition. Could this be the same cause? While editing code, I'll suddenly get nonsensical errors such as: switch intent.Status {
case stripe.PaymentIntentStatusSucceeded:
^ cannot compare stripe.PaymentIntentStatusSucceeded == intent.Status (mismatched types stripe-go.PaymentIntentStatus and stripe-go.PaymentIntentStatus) ...which indicates that it has two sets of type information for the same imported package. The imported package has not been updated, so I don't know why gopls would keep two sets. The problem manifests as type errors (types not assignable, comparable, ertc.) and import errors. I'd be happy to report as separate issue. Running |
This change encodes an invariant that, a dependency package will only ever be parsed with trimmed ASTs. Updates golang/go#34410 Change-Id: I2ceab3672c0bae0b98cec2a8e60b92a0c01a900f Reviewed-on: https://go-review.googlesource.com/c/tools/+/196537 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
Also seeing this within |
Change https://golang.org/cl/198317 mentions this issue: |
This change includes dependencies in the cache keys for CheckPackageHandles. This should fix the issue with propagating results to reverse dependencies. Updates golang/go#34410 Change-Id: I025b7f0d6b0dcaa89c3461ebd94eadd35de4955f Reviewed-on: https://go-review.googlesource.com/c/tools/+/198317 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This error should be resolved as of the above CL. |
I'm assuming #34584 should also be closed, since it looks to be the same issue? |
This change includes dependencies in the cache keys for CheckPackageHandles. This should fix the issue with propagating results to reverse dependencies. Updates golang/go#34410 Change-Id: I025b7f0d6b0dcaa89c3461ebd94eadd35de4955f Reviewed-on: https://go-review.googlesource.com/c/tools/+/198317 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
Forked from microsoft/vscode-go#2759, as well as several messages on Slack.
This is a fairly unreproducible bug, but it seems that we have a race condition wherein a package may be type-checked with 2 versions of the same dependency. This seems to happen more frequently with packages with test variants. It results in error messages that read something like "type X cannot be used as type X in ...".
The text was updated successfully, but these errors were encountered: