terraform-ls: fatal error: concurrent map read and map write
Versions
Extension
v2.24.1
VS Code
Version: 1.72.0-insider
Commit: c4722f1bb292284e0437eb7547808a5788fe6430
Date: 2022-09-02T05:31:10.468Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: Yes
Operating System
macOS 12.5 (21G72), Apple M1 Pro
Terraform Version
Terraform v1.2.8
on darwin_arm64
Steps To Reproduce
Expected Behavior
When I save a terraform file, it should be formatted and saved almost instantly.
Actual Behavior
When I save a terraform file, it sometimes is formatted and saved almost instantly.
However, often the saving of the file is delayed by many seconds while terraform language server seems to be processing it.
Sometimes it will format and save. Sometimes it fails and the file is saved without needed terraform formatting changes. This is typically (always?) paired with an error messages related to terraform language server.
Additional context
Our entire team is affected by this problem. We are all on similar hardware and software component versions as well as working with the same (large) set of terraform configurations for our company.
This has been happening to us for a long time, but it has become much more frequent of late and is impacting us to the point of needing to report it.
In the past a restart of Vscode seemed to clear this problem up temporarily, but it always returned after a time. We kind of got used to routinely needing to restart Vscode to clear this issue.
This causes issues with our workflow as we expect the changed file to immediately pick up formatting fixes and be ready for “terraform apply”, but find it is not from time-to-time and must wait for it the file to finally be saved before applying.
Lately reloading the window nor relaunching Vscode entirely seem to be a reliable “fix”.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 21 (6 by maintainers)
I believe I found the root cause and have a fix in https://github.com/hashicorp/terraform-ls/pull/1086 / https://github.com/hashicorp/terraform-schema/pull/149 (currently pending review)