hashicorp / vscode-terraform

HashiCorp Terraform VSCode extension
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
Mozilla Public License 2.0
925 stars 179 forks source link

High memory usage #134

Closed jackharvey1 closed 4 years ago

jackharvey1 commented 6 years ago

I'm unable to use the extension as the memory usage will grow to about 1.2gb before ultimately crashing.

I was unable to find any specific behaviour that causes this. Once I open VSCode and ran it in the background and when I tried to switch back it crashed.

I saw the issue regarding high CPU usage and I didn't see this as an issue. It's at 100%, which is very high, but it stayed stable whilst the memory usage climbed.

My colleague has reported a similar issue. We're both running Mac OS, but on different Mac models.

I do have many terraform projects (estimate 40-50 files) in my workspace.

mauve commented 6 years ago

Can you try setting terraform.indexing.enabled to false? Does it behave better with indexing disabled?

Can you share your templates with me?

jackharvey1 commented 6 years ago

Thanks for the quick reply mauve. I tried that setting but the issue persisted. I watched the memory usage climb from ~500mb to 1.54gb over 5 minutes before it crashed.

image

All our repos are private so I'd have to check with my manager, what sort of things were you looking for so that maybe I could narrow the request down?

Edit: Disabling Code Lens has me steady for the past 5 minutes

mauve commented 6 years ago

@jackharvey1 did you disable the codelense feature or the indexing feature?

sharing the templates just enables me to test it locally, but I understand if that is not possible.

Fun Fact: Your top 3GB of RAM are consumed by software I have contributed to :)

jackharvey1 commented 6 years ago

Sorry if I wasn't clear. I disabled indexing and VSCode still crashed. When I re-opened VSCode after the crash I enabled indexing & disabled code lens and I still don't have a crash.

mauve commented 6 years ago

disabling indexing will disable codelense as well as the codelense feature is dependent on indexing to work.

Both settings require a restart to take effect. Anyway thanks for verifying that it is the codelense feature which is causing the problem.

jackharvey1 commented 6 years ago

I didn't know VSCode needed a restart for the settings to take effect -- that means I've had indexing disabled this whole time, not code lens. Realising this I restarted so that just code lens was disabled and the memory usage started to climb rapidly again. Once that happened I re-disabled indexing, restarted and I'm stable again, so looks like it's indexing.

Looks like it's sorted for the time being then. Thanks for your help, this extension is pretty great.

mauve commented 6 years ago

VSCode doesn't need a restart for settings to take effect, however my plugin requires a restart for some changes to take effect (for example terraform.indexing.enable and terraform.codelens.enabled both require a restart/reload).

Just to verify it is indexing which is causing the memory usage.

Can you please check with your manager if you can share your templates with me (privately)? Would be nice to be able to debug this properly.

Sherlock-Holo commented 5 years ago

when I install this extension and enable it, it eat my 5G mem, after disable it, vscode memory usage becomes normal.

Sherlock-Holo commented 5 years ago

when I use arch official repo code(build vscode from srouce by arch linux) with this extension, the memory leak doesn't happen, but it still cause 100% CPU

paultyng commented 4 years ago

We just released v2.0.0-rc.1 of the extension. The main features include:

You can find additional information and specifics in the release notes and CHANGELOG.

With this release we expect that many of the prior issues and PRs are no longer relevant or have been addressed, and are therefore being closed. If you feel the action taken on an issue or PR is in error, please comment as such and we can figure out the appropriate way to address it.

We plan to add the final 2.0.0 release to the marketplace soon, but are actively seeking your feedback now on the release candidates. You can download the .vsix from the releases page and manually install it in VS Code to try it out.

ghost commented 4 years ago

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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.