-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: nil Type crash in staticcheck #54762
Comments
Another crash (also in staticcheck) reported by another single builder run:
Apparently a nil ObjectOf on a SelectorExpr.Sel. None of these look related to the new generics logic. |
Re-running the tests shows a great variety of crashes. https://source.cloud.google.com/results/invocations/48b434a2-c9e7-46a9-acde-57b5fc976081/targets/golang%2Ftools%2Fgopls-legacy%2Fpresubmit-116/log contains more evidence that this is a general race condition between two gopls subsystems: an analysis pass has a nil entry in the map of
|
Change https://go.dev/cl/426802 mentions this issue: |
Change https://go.dev/cl/426803 mentions this issue: |
This method does not in fact report whether the package is ill-typed. It actually reports whether any of three fields of pkg are nil. They never are. This does rather explain why type-error analyzers are executed on (genuinely) ill-typed packages, despite the !IllTyped() condition. And why analyzers that aren't prepared to handle ill-typed code (!RunDespiteErrors) sometimes crash in production. Updates golang/go#54762 Change-Id: I95421584bec68fb849b5ed52cc4e6d9b6bb679be Reviewed-on: https://go-review.googlesource.com/c/tools/+/426802 Auto-Submit: Alan Donovan <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> Run-TryBot: Alan Donovan <[email protected]>
This change prevents analysis from running on a package containing any kind of error unless the analyzer has indicated that it is robust. This is presumed to be the cause of several panics in production. And a test. Updates golang/go#54762 Change-Id: I9327e18ef8d7773c943ea45fc786991188358131 Reviewed-on: https://go-review.googlesource.com/c/tools/+/426803 Run-TryBot: Alan Donovan <[email protected]> Auto-Submit: Alan Donovan <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Findley <[email protected]>
Moving this to gopls/v0.10.1; I don't think we need to remove our panic recovery just yet. |
Change https://go.dev/cl/426018 mentions this issue: |
Report a bug when an analysis dependency is found to be neither "vertical" (for facts) or "horizontal" (for results). This has been observed in practise: the lookup from a package ID to a package object is not consistent. The bug report is suppressed for command-line-arguments packages to see whether it occurs on ordinary packages too. Also, add disabled logic to disable recovery and dump all goroutines, for temporary use when debugging. Unrelated things found during debugging: - simplify package key used in analysis cache: the mode is always the same constant. - move TypeErrorAnalyzers logic closer to where needed. Updates golang/go#54655 Updates golang/go#54762 Change-Id: I0c2afd9ddd4fcc21748a03f8fa0769a2de09a56f Reviewed-on: https://go-review.googlesource.com/c/tools/+/426018 Reviewed-by: Robert Findley <[email protected]>
Change https://go.dev/cl/439116 mentions this issue: |
…rash We recently started using bug.Errorf to report analyzer crashes, causing tests to fail sporadically. Unfortunately the log included only the "panicked" message but not the relevant stack of the panic or of the other goroutines, giving limited evidence on which to investigate the underlying cause, suspected to be in package loading, not the analyzer itself. This change causes such crashes to display all stacks so that we can gather more evidence over the next few days before we suppress the crashes again. Updates golang/go#54762 Updates golang/go#56035 Change-Id: I2d29e05b5910540918816e695b458463a05f94d9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/439116 Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Alan Donovan <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]>
Change https://go.dev/cl/440178 mentions this issue: |
It has a known bug, and the purpose of the PanicOnBugs is to find unknown bugs. Updates golang/go#54762 Updates golang/go#56035 Change-Id: Id9fdfff478ef52b1d864acee366991808baeb574 Reviewed-on: https://go-review.googlesource.com/c/tools/+/440178 Run-TryBot: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]>
Change https://go.dev/cl/440179 mentions this issue: |
We now have a plausible model for the cause of the analysis crashes and are disabling this check until we have submitted a plausible fix. (Specifically: actionHandle.promise may be a stale promise for an older package with the same ID, since snapshot.actions uses the package ID as a key. This causes us to re-use stale inspectors, whose syntax nodes won't be found in TypesInfo.) Updates golang/go#54762 Updates golang/go#56035 Change-Id: I1a7cc1b02b8c322692b1a6bee03f6cd858c08ea0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/440179 TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Run-TryBot: Alan Donovan <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Auto-Submit: Alan Donovan <[email protected]>
Change https://go.dev/cl/420538 mentions this issue: |
Most invalidation happens in snapshot.clone, but to be safe we were also invalidating package data when new metadata is set via packages.Load. At the time, I wasn't sure why this was necessary. Now I understand: with experimentalUseInvalidMetadata it is possible that we re-compute invalidated data using stale metadata in between the initial clone and the subsequent reload. I noticed that it was also possible to have stale analysis results after the Load results arrive. Fix this by invalidating analysis results on Load, in addition to packages. Factor out invalidation into a new helper method. Since we believe this may fix analyzer panics, re-enable strict handling of analysis panics during tests. For golang/go#56035 For golang/go#54762 For golang/go#42857 Change-Id: I8c28e0700f8c16c58df4ecf60f6127b1c05d6dc5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/420538 Run-TryBot: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
We believe this issue was fixed by https://go.dev/cl/443100. Closing. |
This crash was observed on one builder run when the panic/recover was removed from analysis in gopls:
The apparent cause is TypeOf(BinaryExpr) returning nil, which is then passed to NewTypeSet. The BinaryExpr in question is a "|" union operator over type constraints. Questions:
The text was updated successfully, but these errors were encountered: