-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: memory issues / multiple instances of gopls running while using neovim/vim-go/coc.vim #41998
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
Comments
Sorry, but a couple gigs of usage is not totally out of line with expectations, and I don't see anything obviously wrong in the memory dumps. I think you'd have more luck figuring out why you have 3 copies of gopls running. cc @findleyr for what seems to be a vim thing based on the |
Hmm, I see 9 gopls instances actually: 2 daemons, 3 'sidecars', and 4 'forwarders'. Were you by chance playing around with different configuration? Do you have multiple neovim processes running? I'm guessing the multiple daemons are due to https://golang.org/issue/41266, unfortunately. Neovim users may be better off not using a daemon until that is resolved (or using a manually started daemon). Can you please try killing all the gopls instances to test if you experience the same symptoms in a fresh session? |
I only have one neovim process running, but as you suspect @findleyr, I have been playing with settings and may have both Immediately after a After changing settings to add -remote=auto to the CocConfig here:
And disabling I've updated the issue name to be less accusatory of gopls :) looking to be more of an issue with editor integration (unsurprisingly, i'm sure). |
I'm glad to hear that things are somewhat better, but it sounds like there are still some improvements to be made. First, what is your motivation for using multiple plugins with a single editor process? When using gopls, each will have their own LSP session and will send text updates independently. I'd expect this to cause problems like duplicate diagnostics, etc. Second, which version of vim-go are you using? I'd be interested to know if vim-go is using If it is intentional to have multiple gopls sessions for a single neovim process, there are things we can try that could significantly increase the amount of shared cache between these sessions, provided they are both on the same daemon (for example, in https://golang.org/cl/260737 I added an experiment that modifies our cache key for type information in such a way that it should now be shared when multiple plugins have gopls sessions). Let me know. This is an interesting use-case, and I'd greatly appreciate any follow-up you're able to do here. |
@findleyr thanks!
Partially an accident of history, partially intentional: I started with vim-go (on standard vim) last year and liked it. I recently learned about NeoVim and COC - which provides a lot of great highlighting and code completion that vim-go doesn't provide (as far as I know). I like a lot of the features that vim-go does provide - like triggering tests, formatting, linting I've already configured, etc - so I'm keeping it around for now for that reason.
Indeed, I ran across this (getting double entries in the COC highlight bubbles). My current configuration seems to be avoiding that issue now.
I believe I'm on 1.24, the latest release.
have you seen this? https://github.com/ericwq/golangIDE/blob/master/shared-gopls-daemon.md not sure if that's helpful here. I've changed things a bit since I last wrote here, but the results still seem positive. I have the following {
// [...]
"go.goplsArgs": ["-remote=auto", "-logfile", "/tmp/gopls.log"],
"go.goplsPath": "/home/vcavallo/go/bin/gopls",
// [...]
} And I've removed the So hopefully both vim-go and coc-go are using gopls properly with -remote=auto and using the same binary. But to be honest, once things started working well enough I stopped troubleshooting and got back to work.
Nope. I'd like the option to have arbitrary vim/neovim plugins and not have to worry about how many gopls sessions they're starting up. But I realize that will likely ultimately be a plugin config responsibility and not gopls's problem. |
Thanks for the update, it's useful to hear the process that led you into this state. Getting daemon discovery right is a fundamentally hard problem, because in some cases we want to have multiple daemons (for example, if there's a version mismatch in the gopls binary). I just want to reduce the friction for plugins to find the right daemon. I'll leave this open as a meta-issue tracking this problem. |
Looks like this is being tracked in #41266, so going to go ahead and close this issue. |
Does anyone have an easy to follow recommendation how to make this problem go way with vim-go (not coc)? Every time I'm working on a large project (https://github.com/openshift/installer), it takes gopls mere minutes to eat out 8-10G of RAM and get killed by OOM killer. |
@dtantsur: Please take a look at the memory usage section of the troubleshooting guide and open a new issue. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Opened a large, module-based project from its root folder (where there are go.mod and go.sum files), started editing files, memory usage skyrockets and system begins freezing hard.
Using:
(from
:CocInfo
within NeoVim)memory zips from tmp this morning:
gopls.27845-2GiB-nonames.zip
gopls.15708-2GiB-nonames.zip
gopls.15708-1GiB-nonames.zip
gopls.27845-1GiB-nonames.zip
What did you expect to see?
normal editor usage
What did you see instead?
out of memory issues on overall OS.
The text was updated successfully, but these errors were encountered: