-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: using a lot of memory #37223
Comments
Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here. |
It seems like analysis is causing the high memory usage. Can you try disabling it by adding the following to your VS Code settings? "gopls": {
"experimentalDisabledAnalyses": [
"asmdecl", "assign", "atomic", "atomicalign",
"bools", "buildtag", "cgocall", "composite", "copylock",
"errorsas", "httpresponse", "loopclosure", "lostcancel",
"nilfunc", "printf", "shift", "stdmethods",
"structtag", "tests", "unmarshal", "unreachable", "unsafeptr",
"unusedresult", "deepequalerrors",
"sortslice", "testinggoroutine"
],
}, We also just released gopls/v0.3.2 - can you try downloading that to see if affects anything? ( |
Can you check your /tmp directory for files named |
Hi, I just tried, adding the options in vs code setting doesn't help. And I also update to 0.3.2, looks the same, memory up to 9G. Please see the attached zip file which includes svg for memory profile. Also I didn't find any files name gopls.* under /tmp, instead in my home directory there is a folder named pprof which contains some files with gopls, then I include one is generated at the same timestamp in the zip. Anything else please tell me. Thanks |
Change https://golang.org/cl/219897 mentions this issue: |
Thanks for the profiles. Looks like the inspect analysis is still using the majority of the memory. I've disabled in analyses in CL 219897 - can you try rebuilding This can be done with the following steps: $ cd $(mktemp -d)
$ git clone https://go.googlesource.com/tools
$ cd tools
$ git fetch "https://go.googlesource.com/tools" refs/changes/97/219897/2 && git cherry-pick FETCH_HEAD
$ cd gopls
$ go install This supports @heschik's theory that analyses aren't being canceled in time, and that we are running too many analyses concurrently. |
Change https://golang.org/cl/219958 mentions this issue: |
Diagnostics runs cannot be canceled until they finish a package. If a user has a very expensive package, we may stack up diagnostics runs to the point where the machine runs out of memory. We see hints of this in various issues. To avoid that, only allow one diagnostics run at a time. We can change the limit later if we want. Updates golang/go#37223. Change-Id: Icd0eec4da936153306cf0a1f7175ae2b4b265272 Reviewed-on: https://go-review.googlesource.com/c/tools/+/219958 Reviewed-by: Rebecca Stambler <[email protected]>
Hi, good news with CL 219897, now the memory stays low even I remove experimentalDisabledAnalyses from the vs code config. |
Cool, that confirms that it was a problem with analyses. Can you see if https://golang.org/cl/219958 (which is on master now) also helps? |
Hi @heschik , I just git clone https://go.googlesource.com/tools and go install from head, it seems working, no memory soar. |
Thanks for confirming! I'll mark this as closed, and https://golang.org/cl/219958 will be part of the gopls/v0.4.0 release. |
Just want to report my case here since related: Using vim-go, that uses gopls underneath, I see my memory usage just growing, need to restart vim after a couple of hours each time. With latest updated binaries using vim-go |
@nikkolasg: Just to confirm, the output of |
Yes! Happy to provide more info if I can help. |
Thanks! Yes, hopefully we can debug this. There should be some files named |
Any idea where I can find this file ? Only thing relevant I find in |
Maybe try looking in whatever the value of |
my tmpdir is empty , so I'm using the same tmpdir as what go returns I guess ? |
Ah, the |
nothing turns out there as well :/ |
I'm hitting the same problem as well. Same version and nothing found with the |
It would be very, very surprising if recent versions of gopls hadn't written any of those files to /tmp while using a problematic amount of memory. Can you triple-check that there isn't an old version anywhere, and that it's actually gopls using the memory? |
I ran the search on The only thing I am not sure of is which version |
Sorry, I don't know how vim-go works at all, but by far the most likely explanation for what you're describing is still that you're using an old version of gopls. If you're on Linux, you can see where the binary comes from using |
Nice ! In fact it was YouCompleteMe that used an old version, no vim-go, I found it by running your command. Updated it manually and so far it works good ! |
i might find the correct setup method for gopls. see the post |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, I have update gopls with
GO111MODULE=on go get golang.org/x/tools/gopls@master golang.org/x/tools@master
$ gopls version
golang.org/x/tools/gopls master
golang.org/x/tools/[email protected] h1:cDdkE3V1eIXwN6tdzqVXVYz3RkYVbE8y0n+sn6klUn4=
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Use vs code 1.42.0, download https://github.com/asticode/go-astilectron-demo and browse its code, after a bit change then save to make gopls activated.
What did you expect to see?
From htop, this memory used by gopls should not be excessive.
What did you see instead?
The memory usage is soar, up to 9G, sometimes 12G by gopls, and it never goes down.
![image](https://user-images.githubusercontent.com/3023271/74520491-a6a58780-4f52-11ea-92ad-5ae4bf51f969.png)
The similar issue is discussed in #30309, @stamblerre encourages to open a new issue.
The pprofile svg file is attached as required (in zip file as github required). Any information needed, pls tell me.
Thanks
pprof001.zip
The text was updated successfully, but these errors were encountered: