-
Notifications
You must be signed in to change notification settings - Fork 182
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
Extension causes high cpu load #591
Comments
Thank you for the report, just looking into it. |
Seeing 100% CPU/memory consumption after a recent terraform-ls upgrade to 2.10.1 in visual studio code running on ubuntu, workaround is to disable the extension for now, also get multiple copies of this error after a period of time "The Language Server: file:///<PATH_TO_MY_WORK> server crashed 5 times in the last 3 minutes. The server will not be restarted." |
I'm still not sure what would cause the CPU load, but so many instances of LS running at the same time doesn't look right.
Can you take a look into the output pane, switch to |
Looks like there is a copy of terraform-ls for each one of my repos that contain terraform configuration which is 24 x ~150-200mb in size so that exhausts the memory fairly quickly as they appear to fire up in parallel when opening the workspace, I searched the output for "panic" but not found, however there are lots of repeats of this message, 2021/05/03 11:25:26 module_loader.go:118: no available capacity, retrying dispatch another note is after about 20 mins of high cpu/memory it does eventually settle down but during the wait the machine is unusable, this definitely only started with the recent upgrade was working fine before that, can do a remote session if you want a closer look |
@mattduguid Thank you for sharing these details and for your willingness to help debug this problem.
There was a bug in LS 0.16.0 where it would crash under certain conditions, but that bug is fixed in 0.16.1 (released on Friday 30th). Have you since tried upgrading to that version?
I would be more than happy to jump on a remote session with you. I can't see any contact details on your GitHub, but do let me know if you're still up for it - radek I'm UK based, which could make scheduling a little bit tricky (assuming you're NZ based), but I hope we can still find a window?
This basically just means there are some background jobs (such as pulling schema or checking TF version) scheduled but prevented from running to avoid completely oversubscribing the CPU, but (obviously) these control mechanisms are only in effect within the process. So each individual LS instance should be capped in terms of CPU usage, but I'm assuming the problem occurs when too many instances run in parallel. The LS/extension do not have native multi-workspace support yet, so it is possible that the extension will launch 1 LS instance for each workspace currently as a workaround. This would suggest you have ~24 workspaces (with TF code) opened/active in VS Code - is that right? If not then that sounds like a bug. If yes then that sounds like a +1 bump for this feature hashicorp/terraform-ls#482 |
Hey, it seems that the issue came back on versions 2.[16,17].0. I have downgraded to 2.15.0 and it seems to be a bit better. |
Thanks, this has helped me as well. The extension was chewing 800% of my CPU on my Mac. If someone else is too facing the same, this is what you have to do.
|
All, We recently released v2.180 of the extension, which changes |
hey @jpogran - I have tried the same and things are definitely looking better to me. |
We have also just released language server With that in mind, I believe we have done all we could based on the data and knowledge available at this point, so I'm going to close this issue. If someone still experiences high CPU usage after upgrading to the latest 2.18.0+ of the extension and 0.25.2 of LS, I would encourage you to file a new issue and attach details, such as log file, CPU profile and situation in which this occurs. Language server gets updated automatically every 24hours or upon the next VS Code launch/restart, you can find the LS version near the top of the log under Thank you all! |
Looks better on the new versions on my side as well. Thanks for the fix ! (and thanks for our CPU loads as well) |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
hashicorp.terraform-unresponsive.cpuprofile.txt
Performance
terraform
2.8.2
Darwin x64 20.3.0
1.54.3
/var/folders/hb/xnhpm6ws28bgzf5lmzr0f4kr0000gn/T/hashicorp.terraform-unresponsive.cpuprofile.txt
Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load
The text was updated successfully, but these errors were encountered: