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: use a per-process shared temp directory #42252

Open
findleyr opened this issue Oct 28, 2020 · 3 comments
Open

x/tools/gopls: use a per-process shared temp directory #42252

findleyr opened this issue Oct 28, 2020 · 3 comments

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Oct 28, 2020

gopls can generate a fairly wide-range of temp files and directories (logs, heap dumps, temp modfiles, gc details data, and now temp workspace directories).

We should consolidate these into a top-level temp directory for the gopls process, both so that they are co-located, and so that we can have a catch-all clean up pass when the gopls process exits.

@heschi
Copy link
Contributor

@heschi heschi commented Oct 29, 2020

I think this is generally good, but we want the memory debug zips to be discoverable. IMO either the temp dirs should be predictably named, or the debug zips should stay at the top level.

@findleyr
Copy link
Contributor Author

@findleyr findleyr commented Oct 29, 2020

I was imagining /tmp/gopls-<pid>/, which could contain trace.log, stderr.log, details/, workspace/, 1GB-nonames.zip, for example.

@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default Nov 10, 2020
@stamblerre stamblerre moved this from Needs Triage to Non-critical in vscode-go: gopls by default Nov 10, 2020
@stamblerre stamblerre moved this from Non-critical to Needs Triage in vscode-go: gopls by default Nov 11, 2020
@stamblerre stamblerre moved this from Needs Triage to Non-critical in vscode-go: gopls by default Nov 11, 2020
@stamblerre stamblerre removed this from Non-critical in vscode-go: gopls by default Dec 16, 2020
@stamblerre stamblerre added this to To Do in gopls: v1.0.0 Feb 28, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 10, 2021

Change https://golang.org/cl/300409 mentions this issue: internal/lsp: add a temp workspace per folder, and a helper command

gopherbot pushed a commit to golang/tools that referenced this issue Mar 15, 2021
Locating the workspace module by convention has multiple problems:
 + gopls's view of $TMPDIR might be different from the client
 + there might be multiple views
 + there might be multiple gopls sessions per pid

Instead, assign a temp workspace directory for each workspace folder,
and provide a command to access this information.

Cleaning up all these temp directories was overcomplicated. Instead,
create a temp directory for the gopls server to nest them under, that
can be removed up on server shutdown.

Also fix a bug where the snapshot was not acquired before copying its
workspace.

Updates golang/go#42252

Change-Id: I0641cebe09cd376dfa27373cac30397711c64a8f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/300409
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants