x/tools/gopls: stuck organizeImports
code action
#67923
Labels
Milestone
organizeImports
code action
#67923
gopls built at ae52477ae52477
Observed organize imports stuck (deadlocked) occasionally.
In VS Code where the extension issues the "organizeImports" code action on save by default,
the problem can be surfaced as the "Saving foo.go: Getting Code Actions from ..." popup form.
It started to occur after https://go.dev/cl/589975
but we think the CL is needed to address other problems.
From the goroutine dump, we tracked the following goroutine is waiting on the channels but there is no active producer goroutine.
One obvious bug is we can return too early before starting producers.
https://github.com/golang/tools/blob/ae524770c657808d9d9bb7dc3a622c7104e345a5/internal/imports/fix.go#L1711
This type of race is hard to reproduce (depends on the timing, cpu power, # of candidates in go module cache) on different machines, but once it occurs, the user will likely experience the issue repeatedly. :-(
The text was updated successfully, but these errors were encountered: