Skip to content
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: snapshot leak via view.importsState #53780

Closed
findleyr opened this issue Jul 11, 2022 · 1 comment
Closed

x/tools/gopls: snapshot leak via view.importsState #53780

findleyr opened this issue Jul 11, 2022 · 1 comment
Assignees
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

Comments

@findleyr
Copy link
Member

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.

@findleyr findleyr added this to the gopls/v0.9.1 milestone Jul 11, 2022
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jul 11, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/416874 mentions this issue: internal/lsp/cache: don't pin a snapshot to view.importsState

@findleyr findleyr modified the milestones: gopls/v0.9.1, gopls/v0.9.2 Jul 13, 2022
@findleyr findleyr self-assigned this Aug 8, 2022
@golang golang locked and limited conversation to collaborators Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

2 participants