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

fix: Report both IO errors and main_loop errors #17208

Merged
merged 1 commit into from
May 9, 2024

Conversation

Wilfred
Copy link
Contributor

@Wilfred Wilfred commented May 8, 2024

If rust-analyzer receives a malformed LSP request, the IO thread terminates with a meaningful error, but then closes the channel.

Once the channel has closed, the main_loop also terminates, but it only has RecvError and can't show a meaningful error. As a result, rust-analyzer would incorrectly claim that the client forgot to shutdown.

$ buggy_lsp_client | rust-analyzer
Error: client exited without proper shutdown sequence

Instead, include both error messages when the server shuts down.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 8, 2024
@Wilfred Wilfred marked this pull request as ready for review May 8, 2024 23:43
crates/rust-analyzer/src/bin/main.rs Outdated Show resolved Hide resolved
If rust-analyzer receives a malformed LSP request, the IO thread
terminates with a meaningful error, but then closes the channel.

Once the channel has closed, the main_loop also terminates, but it
only has RecvError and can't show a meaningful error. As a result,
rust-analyzer would incorrectly claim that the client forgot to
shutdown.

```
$ buggy_lsp_client | rust-analyzer
Error: client exited without proper shutdown sequence
```

Instead, include both error messages when the server shuts down.
@Veykril
Copy link
Member

Veykril commented May 9, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented May 9, 2024

📌 Commit d993f9d has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 9, 2024

⌛ Testing commit d993f9d with merge 5bf2f85...

@bors
Copy link
Collaborator

bors commented May 9, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 5bf2f85 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants