x/tools/gopls: snapshot leak via view.importsState #53780
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Discovered while investigating #50707: When we create a processEnv for running goimports, we acquire the snapshot: https://cs.opensource.google/go/x/tools/+/master:internal/lsp/cache/imports.go;l=146;drc=53ead67a981c04bcacdd4f593330c43ee9285578
But the process env is associated with the view, and so this snapshot is not released until the imports state is invalidated (which can be the entire editing session).
As a result, we hold on to whichever snapshot was used to create the process env. As time passes the data referenced by this snapshot becomes staler and staler, and is increasingly duplicated. In brief testing this leak seemed significant.
The text was updated successfully, but these errors were encountered: