Skip to content

Performance issues on large terraform project on v0.36.3 #1907

Open
@mariuskimmina

Description

@mariuskimmina

Language Server Version

v0.36.3

I've been experiencing similar problems with older versions as well.

Terraform Version

v1.9.3 on linux_amd64

Client Version

NVIM v0.10.2

Behavior

Autocompletion suggestions aren't showing up at all, diagnostics are taking a long time. Often when going form insert mode to normal node I see diagnostics come in letter by letter.

Go to definition still works more or less snappy.

CPU utilization is quite high
image

When enabling lsp logs with

    vim.lsp.set_log_level("debug")

I notice that lsp.log is filling up with really quickly with over 300k lines after only a few minutes of usage.
here are some exmaples, I don't think they are actual errors tho, as has been mentioned before in #1234

[ERROR][2024-12-22 23:35:16] .../vim/lsp/rpc.lua:770	"rpc"	"/home/marius/.local/share/nvim/mason/bin/terraform-ls"	"stderr"	'2024/12/22 23:35:16 complete.go:51: Looking for candidates at "scylla.tf" -> hcl.Pos{Line:5, Column:42, Byte:190}\n'
[ERROR][2024-12-22 23:35:16] .../vim/lsp/rpc.lua:770	"rpc"	"/home/marius/.local/share/nvim/mason/bin/terraform-ls"	"stderr"	"2024/12/22 23:35:16 complete.go:53: received candidates: lang.Candidates{List:[]lang.Candidate{}, IsComplete:true}\n"
[ERROR][2024-12-22 23:35:16] .../vim/lsp/rpc.lua:770	"rpc"	"/home/marius/.local/share/nvim/mason/bin/terraform-ls"	"stderr"	'2024/12/22 23:35:16 rpc_logger.go:53: Response to "textDocument/completion" (ID 81): {"isIncomplete":false,"items":[]}\n2024/12/22 23:35:16 opts.go:215: Completed 1 requests [3m49.888921128s elapsed]\n'
[DEBUG][2024-12-22 23:35:16] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  id = 81,  jsonrpc = "2.0",  result = {    isIncomplete = false,    items = {}  }}
[ERROR][2024-12-22 23:35:16] .../vim/lsp/rpc.lua:770	"rpc"	"/home/marius/.local/share/nvim/mason/bin/terraform-ls"	"stderr"	'2024/12/22 23:35:16 rpc_logger.go:53: Response to "textDocument/semanticTokens/full" (ID 80): {"data":[0,0,6,7,0,0,7,8,0,0,1,2,6,5,1,0,25,29,6,0,1,2,22,5,0,0,25,9,6,0,1,2,21,5,0,0,25,9,6,0,1,2,16,5,0,1,2,7,5,0,0,25,6,8,0,0,7,10,8,0,0,11,19,8,0,1,2,14,5,0,0,25,4,2,0,1,2,6,5,0,0,25,5,2,0,1,2,6,5,0,0,25,5,6,0]}\n2024/12/22 23:35:16 opts.go:215: Completed 1 requests [3m50.325223322s elapsed]\n'

Project Structure

The file tree would be to big to post here, according to find . -name '*.tf' | xargs wc -l we are at 56548 lines across many hundreds of files.

the rough structure is something like

* environments/
  * prod/
  * sandbox/
* modules/
  * module-1/
  * module-2/

I notice that inside a module the performance is much better than when making changes in one of the environment directories. Also CPU utilization is much lower there.

Gist

No response

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions