-
Notifications
You must be signed in to change notification settings - Fork 57
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
'connection to server' error when start of vscode #676
Comments
Sorry that you're unable to use the extension. Can you provide more details to help debug the issue?
Thanks for providing the trace logs but that doesn't seem to match what I'm seeing in the server logs. For example, I see that there's a I'm also curious to know what are those "A/B experiments"? |
No problem. It happens just after installation of extension. With default settings. I use python 3.12. A/B experiments were added by internal tool of vscode ide which generates bug reports. Yes, logs are for the same session. The defect persists every time I start ide, or restart server. |
That's interesting because the server logs and the trace logs does not match. For example, the
has no corresponding entry in the trace logs, ideally there should be. Does you VS Code settings look like this? {
"ruff.logLevel": "trace",
"ruff.trace.server": "verbose"
} |
@dhruvmanila Yes. My settings are:
Hmm, ... to be able to fix this error, i put
Today, i tried to reproduce error and to get logs one more time . I have put And error is no longer reproducible, strange behavior .... |
@dhruvmanila I have found the root cause of the problem. |
Hmm, that's worrying as it shouldn't cause any failure.
I think it would be useful to make sure that the logs are correct. What's the version of the Ruff that you're running? Can you try using the bundled Ruff executable by setting |
@dhruvmanila I use 2025.4.0. I have put
but it didn't help - problem still persists. |
same problem here.
|
I also observed this. I turn it off temporarily waiting for the developers to fix it. I also mentioned this at astral-sh/ruff#15991 |
@DingXuefeng Are you able to reproduce this every time on any project that you open VS Code in? In your case, I'm wondering if it has got to do anything with request cancellation. The native server does not support cancellation but it seems that we send a default response to the request instead of ignoring it. I'm not sure how does a client consider that response. |
Happens for me as well, but only in WSL, not Windows proper. |
@Martin-Milbradt Are you able to reproduce this consistently? Can you provide more details to help us narrow down the issue by providing us extension and server logs? |
Extension looks fine:
Language Server errors out:
The Language Server also has issues in Windows proper, but they don't get propagated to the top level (didn't notice them until checking out the log) and they don't seem to impact behavior.
|
Thank you for the details. I'm not sure what's triggering the "Server received unexpected response..." during the shutdown but I don't think we're handling that well. Currently, it seems that we're returning an error but rather we should be returning a LSP error with |
## Summary This PR should help in astral-sh/ruff-vscode#676. There are two issues that this is trying to fix all related to the way shutdown should happen as per the protocol: 1. After the server handled the [shutdown request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#shutdown) and while waiting for the exit notification: > If a server receives requests after a shutdown request those requests should error with `InvalidRequest`. But, we raised an error and exited. This PR fixes it by entering a loop which responds to any request during this period with `InvalidRequest` 2. If the server received an [exit notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#exit) but the shutdown request was never received, the server handled that by logging and exiting with success but as per the spec: > The server should exit with success code 0 if the shutdown request has been received before; otherwise with error code 1. So, this PR fixes that as well by raising an error in this case. ## Test Plan I'm not sure how to go about testing this without using a mock server.
@Akopov4 @Martin-Milbradt @DingXuefeng Hi, there's a new Ruff release that went out yesterday accompanied by a new VS Code extension release which contains a fix related to this. Can you try upgrading and see if the issue persists? If it still persists, then I think the logs should now provide more details than before. |
Still erroring out (Windows proper this time):
|
@Martin-Milbradt Can you make sure you're on the latest Ruff version ( which should be just a warning log message with:
Notice that the If you're using the latest VS Code extension ( |
Looks good now, I forgot to update the ruff CLI, only updated the VSCode plugin. |
Thanks for the update. I'll mark this as resolved then but happy to hear from others in this thread. |
Type: Bug
On start of vscode i see connection error. See attached logs.
Extension version: 2025.4.0
VS Code version: Code 1.96.4 (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Linux x64 6.8.0-51-generic
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
A/B Experiments
Logs
Ruff_Language Server_Trace.txt
The text was updated successfully, but these errors were encountered: