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

Couldn't connect to the lang.server at random port #713

Closed
ParadoxV5 opened this issue Sep 9, 2024 · 8 comments
Closed

Couldn't connect to the lang.server at random port #713

ParadoxV5 opened this issue Sep 9, 2024 · 8 comments

Comments

@ParadoxV5
Copy link

ParadoxV5 commented Sep 9, 2024

Godot version

v4.3.stable.steam [77dcf97d8]

VS Code version

Version: 1.93.0 (system setup)

Godot Tools VS Code extension version

v2.1.0

System information

Windows 11

Issue description

The extension fails with a random port number unless it’s reloaded after opening the VSCode Settings window (placebo) until half a minute after Godot Engine starts.

Couldn't connect to the GDScript language server at 127.0.0.1:random number. Is the Godot editor or language server running?

Yes, random port number, differing each failed retry, as if reading from an uninitialized uint16.

Steps to reproduce

I opened my project VSCode (from Godot or manually) after opening it in Godot Editor.

settings.json

{
"godotTools.editorPath.godot4": "C:/Program Files (x86)/Steam/steamapps/common/Godot Engine/godot.windows.opt.tools.64.exe",
"godotTools.inlayHints.gdscript": true,
"godotTools.lsp.autoReconnect.attempts": 2,
"godotTools.lsp.headless": true,
"godotTools.lsp.serverPort": 6005,
"godotTools.scenePreview.previewRelatedScenes": "anyFolder"
}
@ParadoxV5 ParadoxV5 added the bug label Sep 9, 2024
@DaelonSuzuka
Copy link
Collaborator

Yes, random port number

Headless LSP mode uses a random, high, unoccupied port because the entire purpose is to allow you to open multiple Godot projects in separate VSCode windows without port conflicts.

I suspect that the problem is that you changed godotTools.lsp.autoReconnect.attempts to 2 from it's default value of 10. Starting the engine (even in Headless mode) can easily take more than 6 seconds, so I don't know why you would set the attempts to 2.

@ParadoxV5
Copy link
Author

Thank you for your explaination.

Starting the engine (even in Headless mode) can easily take more than 6 seconds, so I don't know why you would set the attempts to 2.

I expected the connection to be consistent in cases where it should suceed (not considering boot duration vs. timeout).
I dropped this setting to reduce attempts on cases where it should fail (e.g., #696)

@DaelonSuzuka
Copy link
Collaborator

Did fixing godotTools.lsp.autoReconnect.attempts solve your problem?

@ParadoxV5
Copy link
Author

Seems that it is because of the slow startup time of the lang.server.
With 10 attempts, there was no error message.
With 2 attempts, it eventually succeds after clicking reconnect half a dozen times.

Opening the settings window is a placebo because it took time.

@DaelonSuzuka
Copy link
Collaborator

Yes, that's why the default value is 10.

@DaelonSuzuka
Copy link
Collaborator

@ParadoxV5 Are you still experiencing a Language Server connectivity problem?

@ParadoxV5
Copy link
Author

ParadoxV5 commented Sep 23, 2024

@ParadoxV5 Are you still experiencing a Language Server connectivity problem?

I have not had connectivity problems recently;
but I would like the plugin adjusted to not have to rely on a large number of reconnect attempts.

@DaelonSuzuka
Copy link
Collaborator

but I would like the plugin adjusted to not have to rely on a large number of reconnect attempts.

No.

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

Successfully merging a pull request may close this issue.

3 participants