Skip to content

gopls consumes permanent high CPU usage #1041

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

Closed
Klaus-Tockloth opened this issue Dec 17, 2020 · 4 comments
Closed

gopls consumes permanent high CPU usage #1041

Klaus-Tockloth opened this issue Dec 17, 2020 · 4 comments
Labels
FrozenDueToAge gopls gopls related issues upstream-tools Issues that are caused by problems in the tools that the extension depends on.

Comments

@Klaus-Tockloth
Copy link

What version of Go, VS Code & VS Code Go extension are you using?

  • go version go1.15.6 darwin/amd64
  • golang.org/x/tools/gopls v0.6.0
  • Visual Studio Code Version: 1.52.1
  • Go for Visual Studio Code v0.19.1

Share the Go related settings you have added/edited

Bildschirmfoto 2020-12-17 um 09 01 14

Bildschirmfoto 2020-12-17 um 09 01 38

Describe the bug

gopls consumes after VS-Code start permanent high CPU usage (and does a lot of internet communication). VS-Code nearly unusable.

Bildschirmfoto 2020-12-17 um 08 53 53

gopls (server) log attached.

gopls-server.log

@hyangah
Copy link
Contributor

hyangah commented Dec 17, 2020

VSCode was opened from the GOPATH/src directory.
@stamblerre What is the current best practice in this case?

@Klaus-Tockloth Are all the packages under the GOPATH related? Is it possible to open only repo directories you intend to actively work on?

@hyangah hyangah added gopls gopls related issues upstream-tools Issues that are caused by problems in the tools that the extension depends on. labels Dec 17, 2020
@Klaus-Tockloth
Copy link
Author

Is it possible to open only repo directories you intend to actively work on?

The problem is gone, if I reduce my workspace.

Large Workspace with 'gopls' CPU consuming problem:
Bildschirmfoto 2020-12-17 um 16 57 08

Small Workspace without 'gopls' CPU consuming problem (workspace reduce to folder 'klaus'):
Bildschirmfoto 2020-12-17 um 16 59 21

Looks like a workaround ... thanks for pointing to this.

@stamblerre
Copy link
Contributor

This case is specifically mentioned here: golang/go#36899. I know this issue is not very discoverable, but its contents will eventually be merged into our documentation. Opening your entire GOPATH/src is not actively supported, but you can use our new directoryFilters to exclude certain directories from analysis by gopls.

@hyangah
Copy link
Contributor

hyangah commented Dec 17, 2020

@Klaus-Tockloth Great to hear that narrowing down the workspace scope made improvement. In general, Go is moving toward modules mode instead of GOPATH mode (eventually, GOPATH will be deprecated), I think it's time to consider the new module-based workflow.

@stamblerre thanks for the pointer. I updated #934 to include the workspace setup in the documentation. Let me close this issue and let's follow up in the documentation improvement work.

@hyangah hyangah closed this as completed Dec 17, 2020
@golang golang locked and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls gopls related issues upstream-tools Issues that are caused by problems in the tools that the extension depends on.
Projects
None yet
Development

No branches or pull requests

4 participants