You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gopls/internal/server: fix a (mostly) benign race in diagnostics
In golang/go#65312, we observed a test flake due to what I believe is a
mostly benign race in diagnostics:
1. diagnoseSnapshot requests session.Views()
2. diagnoseSnapshot computes diagnostics
3. diagnoseSnapshot calls updateDiagnostics for the views from (1)
This means that if a view V were created and diagnosed between (1) and
(3), the call to updateDiagnostics will prune the diagnostics for V,
because it doesn't think it's an active view.
This is fundamentally a flaw in the design of multi-view diagnostics: we
don't a priori know which views apply to a given file, so we have to do
this complicated join. Nevertheless, I think this race is avoidable by
requesting session.Views() inside the critical section of
updateDiagnostics. In this way, it's not possible to overwrite
diagnostics reported by a different View, without also observing that
View.
Fixesgolang/go#65312
Change-Id: Ie4116fbfac2837f7d142c7865758ff6bac92fce4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/563957
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
0 commit comments