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: gopls often becomes unresponsive when working on packages with long compile times #46590
Comments
Hi, thanks for the report. There are two possibilities for what is going on here: one is that gopls RPCs are getting queued up behind a slow request, and another is that your CPU sufficiently saturated to make everything slow. Based on your description of the symptoms, this sounds like the first scenario. In this case, RPC logs would be very helpful. Would you mind grabbing some logs and attaching them here? Instructions for how to do so can be found here.
FWIW I don't see any attached program, but in any case the logs would be most useful. |
GitHub won't let me attach a .go file, and Firefox crashed while I was appending it as a code section and I forgot to update the issue... Here is one of GoTK3's examples that should reproduce the issue. I'll work on getting logs. |
I generated gopls.log.zip using the following settings: "go.languageServerFlags": [
"-logfile", "REDACTED/Desktop/gopls.log",
"-rpc.trace"
],
"gopls": {
"env": {
"GOCACHE": "/tmp/go-build-cache",
}
}, As soon as I do something to trigger an RPC to gopls (such as opening FWIW, I'm using Gentoo with |
I experience the same problem using |
Thanks, I'll experiment with that.
Discussed this a bit with the team as I don't have that much experience with cgo. Yes, this is almost certainly related to cgo, apparently invoked during go list, which would explain the symptoms you describe.
Hmm, I don't yet understand why this would be the case. I'll look into it. |
Yeah, this is a pretty poor experience. I think it might be improved by @stamblerre's work on metadata invalidation, which should be in soon. @echovl which neovim client are you using? I'm guessing the reason you hit a recompilation is that you jumped outside of your workspace, which at least on coc.nvim will trigger a new workspace folder in your session. It should only happen on the first jump, although the build takes so long that may be enough... |
I think the best we can do here is to not become unresponsive after the initial workspace load, which means most gopls behavior continues to work in the presence of stale package metadata (even if a load is ongoing). I'm not 100% sure this will be possible, but @stamblerre's pending changes get us at least part of the way there. Putting this in gopls/v0.7.1, as investigating this is timely. |
Yes I did notice that, after the first jump everything is responsive again, thanks for your help! @findleyr |
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?
I have attached a very basic GTK program that uses
github.com/gotk3/gotk3
. Clean compilation of gotk3 takes quite a while. I am using my own fork of gotk3 - whenever gotk3 has to be recompiled, the build takes quite a while.What did you expect to see?
Actions (in VSCode, using gopls) unrelated to
gotk3
resolve in a timely manner.What did you see instead?
Once gopls triggers a build or whatever of
gotk3
, it is entirely unresponsive until the build is complete. For example, ctrl-clicking on an import statement will not bring up pkg.go.dev, even though that in no way requires gotk3 to be compiled.The text was updated successfully, but these errors were encountered: