Skip to content
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

High CPU utilization #238

Closed
m1keil opened this issue Jul 17, 2020 · 9 comments · Fixed by #239
Closed

High CPU utilization #238

m1keil opened this issue Jul 17, 2020 · 9 comments · Fixed by #239
Labels
bug Something isn't working

Comments

@m1keil
Copy link

m1keil commented Jul 17, 2020

Looks like a similar one to #217, #230
I've tried to provide a simple case but was unable to recreate. My workspace contains multiple modules and Terraform project.

Server Version

❯ /Users/michael/.vscode/extensions/hashicorp.terraform-2.1.1/lsp/terraform-ls --version
0.5.2

Terraform Version

❯ terraform -v
Terraform v0.12.28

Client Version

VSCode

❯ code --version
1.47.2
17299e413d5590b14ab0340ea477cdd86ff13daf
x64

Expected Behavior

terraform-ls to not get stuck on 100%.

Actual Behavior

terraform-ls gets stuck on 100% cpu utilization until killed.

Screencast

I've recorded this as a screencast
The actual behavior is triggered manually by me calling for auto complete ("Trigger Suggest" in VSCode - Ctrl + Space).

CPU Profile

cpu.prof.zip

@radeksimko radeksimko added the bug Something isn't working label Jul 17, 2020
@radeksimko
Copy link
Member

@m1keil Thank you for the report. From my experience with fixing the previous CPU-related bug it would be helpful to have access to the file which the completion was requested in and the position where it was requested.

I don't seem to have access to the screencast, but providing it as copy-paste-able text would be incredibly helpful either way, so I can try to reproduce it without having to retype anything.

FWIW you can also encrypt any sensitive data via PGP using our key: https://www.hashicorp.com/security#secure-communications

@radeksimko
Copy link
Member

The attached CPU profile suggests the hot codepath is the same, or very similar - i.e. it is caused by a config which the parser isn't able to parse for some reason, but I can't tell what the config is or what the reason may be without more data unfortunately.

@m1keil
Copy link
Author

m1keil commented Jul 17, 2020

Hey @radeksimko,
I will try to isolate the case as much as possible and pass you the relevant config.

@m1keil
Copy link
Author

m1keil commented Jul 17, 2020

I believe I managed to create a small test case.
Archive.zip

❯ tree -a
.
├── env
│   └── .terraform
│       └── modules
│           └── modules.json
└── modules
    └── mod
        └── main.tf

5 directories, 2 files

where modules.json:

{"Modules":[{"Key":"whatever","Source":"../modules/mod","Dir":"../modules/mod"}]}

and main.tf:

variable "repo_name" {}

resource "aws_ecr_lifecycle_policy" "policy" {
  for_each = toset(var.repo_name
#trigger here ------------------^
}

The bug gets triggered when editing in main.tf while requesting auto-complete.

@radeksimko
Copy link
Member

Reproduced - thank you! I will look into this.

@jamesskinner
Copy link

@radeksimko I am also seeing high CPU again - same as in #217. I can't say if its the same as this issue as I tend to jump around files a lot so hard to pin down.

I have attached log and CPU files as before in case its useful.

terraform-ls-16580.zip

@radeksimko
Copy link
Member

@jamesskinner I was able to reproduce that one as well and I think it is the same bug which can also be addressed by #239 - at least the CPU wasn't spiking with a custom build with that patch.

@radeksimko
Copy link
Member

Bug fix was shipped in v0.5.3.

Please let me know if you continue having CPU or any other problems by opening a new issue.

@ghost
Copy link

ghost commented Aug 20, 2020

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.

@ghost ghost locked and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants