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

Language server fails to start - Windows 10 #1301

Open
iamlorax opened this issue Dec 14, 2022 · 7 comments
Open

Language server fails to start - Windows 10 #1301

iamlorax opened this issue Dec 14, 2022 · 7 comments
Labels

Comments

@iamlorax
Copy link

iamlorax commented Dec 14, 2022

Issue Description

I am unable to run the extension after a fresh install and am getting the error listed below:
Connection to server got closed. Server will not be restarted.

Running the same command in powershell works as intended:
c:\Users******.vscode\extensions\hashicorp.terraform-2.25.1-win32-x64\bin\terraform-ls.exe serve
2022/12/14 14:51:37 serve_command.go:101: Starting terraform-ls 0.30.1
2022/12/14 14:51:37 service.go:99: Preparing new session ...
2022/12/14 14:51:37 langserver.go:94: Starting server (pid 2488; concurrency: 4) ...

Environment Information

Terraform Information

Version: Not found (Terraform v1.3.6)
Platform: Not found (windows_386)
Outdated: false

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19045
VSCode 1.74.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
autodocstring njpwerner 0.6.1
better-comments aaron-bond 3.0.2
Bookmarks alefragnani 13.3.1
code-spell-checker streetsidesoftware 2.12.0
git-graph mhutchie 1.30.0
githistory donjayamanne 0.6.19
gitlens eamodio 13.1.1
isort ms-python 2022.8.0
markdown-preview-enhanced shd101wyy 0.6.5
powershell ms-vscode 2022.11.0
python ms-python 2022.20.1
terraform hashicorp 2.25.1
trailing-spaces shardulm94 0.4.1
vscode-icons vscode-icons-team 12.0.1
vscode-pull-request-github GitHub 0.56.0
vscode-pylance ms-python 2022.12.20
xml DotJoshJohnson 2.5.1

Extension Logs

Launching language server: c:\Users******.vscode\extensions\hashicorp.terraform-2.25.1-win32-x64\bin\terraform-ls.exe serve
Failure to start terraform-ls. Please check your configuration settings and reload this window
[Error - 2:39:06 PM] Connection to server got closed. Server will not be restarted.

@jpogran
Copy link
Contributor

jpogran commented Dec 16, 2022

Hi @iamlorax, can you post the Terraform config section in your settings? Also, what scope (user, workspace, etc) your settings are in? I think there is a configuration error that is preventing the extension from starting successfully

@iamlorax
Copy link
Author

@jpogran
defaultSettings.json = {
"terraform.languageServer.args": [
"serve"
],
"terraform.languageServer.enable": true,
"terraform.languageServer.ignoreSingleFileWarning": false,
"terraform.languageServer.indexing.ignoreDirectoryNames": [],
"terraform.languageServer.indexing.ignorePaths": [],
"terraform.languageServer.path": "",
"terraform.languageServer.tcp.port": null,
}
settings.json(User) = {
"terraform.languageServer.enable": true,
}

There are not terraform configs in the workspace settings.

@radeksimko
Copy link
Member

@iamlorax Just for clarity, would you mind clarifying what OS are you running this on? Ideally if you could take a screenshot of the System details, that would be great!

Screenshot 2022-12-20 at 16 05 41

I see the for VS Code you mention Windows_NT x64 10.0.19045, i.e. Windows 10 x64 (64bit), but then I also see you have installed Terraform 1.3.6 for windows_386 (i.e. 32bit).

Similarly, can you also obtain version of the LS using the command below?

> c:\Users\radeksimko\.vscode\extensions\hashicorp.terraform-2.25.2-win32-x64\bin\terraform-ls.exe version
0.30.1
platform: windows/amd64
go: go1.19.3
compiler: gc

I am not super familiar with the compatibility constraints between the two architectures on Windows, but this stands out to me at the least. That said, you seem to have the default settings in place, and so if architecture mismatch (between your OS and terraform-ls) is a problem, then we need to understand how did the wrong terraform-ls binary end up there. There could be a bug in our packaging logic.

I do not have access to 32bit Windows myself unfortunately. If you could reproduce this on a different platform and/or architecture, e.g. Linux/x64, that would help confirm or reject the theory.

@iamlorax
Copy link
Author

System Information
Processor Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz 2.21 GHz
Installed RAM 16.0 GB (15.8 GB usable)
System type 64-bit operating system, x64-based processor

I must have downloaded the incorrect Terraform by mistake. I now have the 64-bit version but that did not resolve the issue.
Terraform
terraform -version
Terraform v1.3.6
on windows_amd64

Terraform-ls
c:\Users------.vscode\extensions\hashicorp.terraform-2.25.2-win32-x64\bin\terraform-ls.exe version
0.30.1
platform: windows/amd64
go: go1.19.3

@radeksimko
Copy link
Member

Thank you for providing this promptly, that means we can basically rule out architecture mismatch as root cause.

If you're able to run LS manually from PowerShell, then there must be some differences between how it runs through VS Code, but presumably not the arguments - as the log suggests the serve argument is the only one being passed, as expected.

One possibility that comes to mind is permissions, but when I tried to reproduce that, I received the following in the log:

Launching language server: c:\Users\radeksimko\.vscode\extensions\hashicorp.terraform-2.25.2-win32-x64\bin\terraform-ls.exe serve
[Error - 5:10:47 PM] Starting client failed
Error: spawn EPERM
	at ChildProcess.spawn (node:internal/child_process:413:11)
	at Object.spawn (node:child_process:720:9)
	at c:\Users\radeksimko\.vscode\extensions\hashicorp.terraform-2.25.2-win32-x64\out\extension.js:1:556996

where EPERM clearly indicates the permissions as issue - and this doesn't match the log output you provided.

Just for avoidance of doubt - can you do integrity check on the LS binary? i.e. confirm that the SHA256 hash matches the following?

PS C:\Users\radeksimko> Get-FileHash c:\Users\...\.vscode\extensions\hashicorp.terraform-2.25.2-win32-x64\bin\terraform-ls.exe

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          18CD480A2A0BDDC8C7D853C2B03E6A3CF09EF7948EE798845FFAAC6B3435E6C2       C:\Users\radeksimko\.vscode\e...

If the output matches - i.e. you have the exact same binary, then the only possible next step I can think of is on us - to try to log some more details in the error message about the circumstances of the failure, if the NodeJS/Windows API provides us any. 🤔

closed() {
this.outputChannel.appendLine(
`Failure to start terraform-ls. Please check your configuration settings and reload this window`,
);

@iamlorax
Copy link
Author

iamlorax commented Dec 20, 2022

Output
Get-FileHash c:\Users....vscode\extensions\hashicorp.terraform-2.25.2-win32-x64\bin\terraform-ls.exe
Algorithm: SHA256
Hash: 18CD480A2A0BDDC8C7D853C2B03E6A3CF09EF7948EE798845FFAAC6B3435E6C2
Path: C:\Users....vscode\exte...

Looks like the hash does match.

@github-actions
Copy link

Marking this issue as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

Thank you for understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants