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: massive cpu and memory usage #46897

Open
TheSecEng opened this issue Jun 23, 2021 · 5 comments
Open

x/tools/gopls: massive cpu and memory usage #46897

TheSecEng opened this issue Jun 23, 2021 · 5 comments

Comments

@TheSecEng
Copy link

@TheSecEng TheSecEng commented Jun 23, 2021

What version of Go are you using (go version)?

go version go1.15.7 darwin/amd64

Does this issue reproduce with the latest release?

Yes - With go1.16.4 as well

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/zach.schulze/Library/Caches/go-build"
GOENV="/Users/zach.schulze/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/zach.schulze/go-code/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/zach.schulze/go-code"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/private/var/tmp/_bazel_zach.schulze/507f29846d43dcd14bc7e23ed37206d8/external/go_sdk"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/private/var/tmp/_bazel_zach.schulze/507f29846d43dcd14bc7e23ed37206d8/external/go_sdk/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jc/10b96gcj0gl80vll0lym3njr0000gn/T/go-build512011677=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Start gopls in a mono-repo and begin working

What did you expect to see?

gopls should function properly within a mono-repo. Memory and CPU usage should plateau and no longer climb and slow down the entire machine

What did you see instead?

go and gopls climb in memory and CPU usage till the point I must completely close and restart all go/gopls instances. This is within a single mono repo that is using vs 1.15.7 but is reproducible on the latest gopls and go version.

2021-06-23_10-23-14

2021-06-23_10-23-38

@gopherbot gopherbot added this to the Unreleased milestone Jun 23, 2021
@TheSecEng TheSecEng changed the title x/tools/gopls x/tools/gopls Massive CPU and Memory Usage Jun 23, 2021
@bcmills
Copy link
Member

@bcmills bcmills commented Jun 23, 2021

Duplicate of #45363?

@seankhliao seankhliao changed the title x/tools/gopls Massive CPU and Memory Usage x/tools/gopls: massive cpu and memory usage Jun 23, 2021
@suzmue suzmue removed this from the Unreleased milestone Jun 24, 2021
@suzmue suzmue added this to the gopls/unplanned milestone Jun 24, 2021
@stamblerre stamblerre self-assigned this Jun 25, 2021
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 28, 2021

@TheSecEng: Can you please follow the troubleshooting guide here and share your gopls logs? Also, please take a look at the memory section of the troubleshooting guide and include those zips if you have them.

@stamblerre stamblerre removed their assignment Jun 28, 2021
@TheSecEng
Copy link
Author

@TheSecEng TheSecEng commented Jun 29, 2021

@stamblerre I did the logfile command, however it just logs the LSP commands. And that contains private code that I can't just post here. What are we looking for exactly?

Also, my TMPDIR has this in it

-rw-r--r--   1 zach.schulze  staff  13297 Jun 29 08:52 gopls.7730-1GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  12910 Jun 29 08:52 gopls.7730-1GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13408 Jun 29 08:52 gopls.7730-2GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13412 Jun 29 08:52 gopls.7730-2GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13533 Jun 29 08:52 gopls.7730-3GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13524 Jun 29 08:52 gopls.7730-3GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13415 Jun 29 08:52 gopls.7730-4GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13371 Jun 29 08:52 gopls.7730-4GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13689 Jun 29 08:52 gopls.7730-5GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13418 Jun 29 08:52 gopls.7730-5GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13725 Jun 29 08:52 gopls.7730-6GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13728 Jun 29 08:52 gopls.7730-6GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  14136 Jun 29 09:12 gopls.8191-10GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  14140 Jun 29 09:12 gopls.8191-10GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  14129 Jun 29 09:12 gopls.8191-11GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  14141 Jun 29 09:12 gopls.8191-11GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  14292 Jun 29 09:12 gopls.8191-12GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  14153 Jun 29 09:12 gopls.8191-12GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  16860 Jun 29 09:13 gopls.8191-13GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  16695 Jun 29 09:13 gopls.8191-13GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  17106 Jun 29 09:13 gopls.8191-14GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  17066 Jun 29 09:13 gopls.8191-14GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  17213 Jun 29 09:13 gopls.8191-15GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  17185 Jun 29 09:13 gopls.8191-15GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  17329 Jun 29 09:13 gopls.8191-16GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  17450 Jun 29 09:13 gopls.8191-16GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13026 Jun 29 09:09 gopls.8191-1GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  12629 Jun 29 09:09 gopls.8191-1GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13341 Jun 29 09:10 gopls.8191-2GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13310 Jun 29 09:10 gopls.8191-2GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13349 Jun 29 09:10 gopls.8191-3GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13355 Jun 29 09:10 gopls.8191-3GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13748 Jun 29 09:10 gopls.8191-4GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13791 Jun 29 09:10 gopls.8191-4GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13813 Jun 29 09:10 gopls.8191-5GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13753 Jun 29 09:10 gopls.8191-5GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  13972 Jun 29 09:10 gopls.8191-6GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  13812 Jun 29 09:10 gopls.8191-6GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  14054 Jun 29 09:12 gopls.8191-7GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  14031 Jun 29 09:12 gopls.8191-7GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  14091 Jun 29 09:12 gopls.8191-8GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  14100 Jun 29 09:12 gopls.8191-8GiB-withnames.zip
-rw-r--r--   1 zach.schulze  staff  14136 Jun 29 09:12 gopls.8191-9GiB-nonames.zip
-rw-r--r--   1 zach.schulze  staff  14096 Jun 29 09:12 gopls.8191-9GiB-withnames.zip

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 29, 2021

@stamblerre I did the logfile command, however it just logs the LSP commands. And that contains private code that I can't just post here. What are we looking for exactly?

If you can redact out the private pieces of information, it would still be helpful to see. gopls usually logs errors and other useful information. One way to share less information might be to share the output of gopls -v version and the output of gopls -rpc.trace -v check path/to/file.go for a file in your workspace.

The nonames files are redacted, so if you're willing to share one of those zips we can take a look at those too.

@bhcleek
Copy link
Contributor

@bhcleek bhcleek commented Jul 1, 2021

@bcmills yes, this seems like a duplicate to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants