-
Notifications
You must be signed in to change notification settings - Fork 18k
staticcheck and gopls nuke my computer #51829
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
gopls doesn't invoke the Staticcheck binary. Even with Staticcheck enabled in gopls, the checks would execute directly in the gopls process. So this doesn't seem like a gopls issue. |
This may be a vscode-go issue, however. CC @hyangah |
Agree that it's likely the vscode-go issue rather than gopls or go - @bschaatsbergen can you verify staticchecks are the children of a VSCode process? |
I'm seeing similar here. downgrading to 0.8.0 seems to work with setting |
Hi, fwiw I don't think [email protected] should make a difference relative to [email protected]. @ElanHasson are you sure this matters? |
Several internal folks here have reported gopls as being slow for them and eating memory. As you mentioned this may be a vscode-go issue. Downgrading seems to have resolved the issue for us. I did a quick search in vscode issues list and couldn't find anything relevant. What is the best way to gather data on this to help diagnose the issue (or rule out gopls)? |
Gopls does use a lot of memory, but I'd be a bit surprised if it had a regression in v0.8.1, as that was mostly a bugfix release. If you could run [email protected] on your codebase and report its RSS once it has finished loading, then compare with [email protected], that would be very helpful. Which version of Go are you using, and do you use go workspace? |
I'd say this should be closed as the sluggishness has gone away. |
Thanks for following up! |
so, hate to be "that guy"... Output from VSCode:
|
@ElanHasson your screenshot shows a lot of gopls Can you clarify what you're pointing out? Do you know why you have so many gopls EDIT: threads, not processes |
Hi @findleyr, I'm not sure-- I imagine it's a "feature" of VSCode. I'm not sure if this is a VSCode problem (the staticcheck or multiple gopls). I figured I'd add details here for discoverability. The previous RSS numbers I dropped were very low compared to these above. I'm unfamiliar with the internals of gopls or staticcheck nor how VSCode uses them. I'm going to log an issue in https://github.com/microsoft/vscode and link to this for reference and operate under the impression it's a VSCode issue first. I'd still say leave this closed unless the VSCode folks come back and say something otherwise. |
I don't think this has anything to do with microsoft/vscode. It's either gopls or vscode-go (both of which are us :) ) Reopening to continue investigation:
|
Thanks for clarifying ownership, much appreciated. Versions:
I'm using VSCode WSL-Remote on Windows 11.
|
These are threads, not processes. And the memory statistics for threads mirror that of the owning process. So that's a single gopls process, with several threads, and the gopls process uses 9.6 GiB in total. |
Thanks for pointing that out. After some time it becomes impossible to save any files and it hangs during the static check (at least it seems to). When that happens I can't use any of the go behavior within vscode. For example, finding references, and I get red squiggly lines on valid code that I just added. |
🤦, thanks, I should have noticed the RSS was all the same... I'm afraid 9.6 GiB is not unheard of for large workspaces. For reference gopls uses 3-6gb for kubernetes, depending on whether staticcheck is enabled. I recommend reducing the size of your workspace to modules that you are actively working on, if possible. |
its worth noting the code in my workspace isn't all go code and it is definitely less code than k8s. does gopls have the ability to dump any runtime info? |
There may well be a bug related to that. Can you share a sense of the size of the workspace, in terms of:
Gopls automatically dumps heap to files of the form |
thanks @findleyr will capture data when i hit the issue again. It's going to be difficult to know what should be loaded and not due to that monorepo life. |
Thank you for the data, and sorry for the slow turnaround. Are you able to:
Can you share your gopls settings? Do you have |
Thanks @findleyr, no worries about the turnaround, between holidays, family, and life in general we all get busy 😃 We're on Go 1.18.1. I'll investigate the the I personally do not have |
Just checking in -- did using We're working on redesigning the core of gopls to finally address some of these scaling problems, but in the meantime |
Hi, Someone on the team is experimenting with go.work, I'll check in with them and respond here. For me specifically, I increased the CPU to 16 cores and the problem went away. I watch the CPU spike when I use the show references functionality, sometimes for 10 seconds across all cores. Gopls taking up 50-60% of the 32GB ram. This is using go 1.18.2 and latest versions of gopls and friends. |
I've had this issue too, and in the end |
@barrettj12 I'm sorry to hear that vscode-go became unusable for you. Unfortunately, there are aspects of gopls that scale with the size of the workspace, and so it will (currently) be unusable on large codebases. However, we're working hard on performance improvements, and have landed several for the v0.9.0 release. Right now, these performance improvements are focused on CPU usages while typing, as well as optimizing workspaces that are narrowed using a These optimizations still do not tackle the problem of type-checking the entire workspace. That will take longer to solve, though the "degradeClosed" memoryMode may help. |
@findleyr, just installed, will monitor. I will say after working for ~a month with the increased RAM and CPUs has been radically different. I just installed the Memory Usage is: Will update accordingly if anything changes. |
@findleyr I can report back that |
@ElanHasson that's great news, thanks for reporting back. We've got more improvements in the pipeline: nothing yet that will make an order-of-magnitude improvement, but several things that will reduce a significant fraction of load and memory. I'm going to close this issue now since it's not specifically actionable, though of course performance remains a significant concern for gopls. |
@findleyr thank you for your work on this, it is appreciated! |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Open a large code base in VS code.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Open visual studio code, to be more specific aws-sdk-go project or the hashicorp/terraform-provider-aws project
What did you expect to see?
My project
What did you see instead?
I get logged out because my machine is having a hard time
The text was updated successfully, but these errors were encountered: