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
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@findleyr
Copy link
Member

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.

@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 Oct 28, 2020
@gopherbot gopherbot added this to the Unreleased milestone Oct 28, 2020
@heschi
Copy link
Contributor

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
Member Author

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

@gopherbot
Copy link
Contributor

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>
@findleyr findleyr modified the milestones: gopls/later, gopls/unplanned May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

4 participants