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

Errors flash and disappear (RA crash) after 0.3.2220 version with "Server process exited with code 0" #18781

Closed
tgrushka opened this issue Dec 28, 2024 · 2 comments
Labels
Broken Window Bugs / technical debt to be addressed immediately

Comments

@tgrushka
Copy link

tgrushka commented Dec 28, 2024

I've been using nightly and have noticed this for the past week or so.
Unfortunately, it also occurs in 0.3.2228 release version onwards.

This is a serious regression in nightly and release 0.3.2228 and it's important to fix it before the next release.

When I downgrade to 0.3.2220, the problem goes away.

uname -a
Linux framework-mint 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

code-insiders --version
1.97.0-insider
89f808979a5151bd91324e65d4f7ab1b62896983
x64

Whenever working in code in any #[cfg(test)] blocks (and sometimes outside those blocks), rust-analyzer seems to crash 90% of the time when there's an error in my code that's not "very simple" (i.e. let x: i32 = 3.5;). There are no useful logs. The only output for "Rust Analyzer Language Server" is like this:

[Error - 4:14:38 PM] Server process exited with code 0.

EDIT: Also occurred with fresh install of VS Code Insiders with no other extensions/settings except rust-analyzer.

Screen recording (I am hitting Control-S several times to save; analyzer runs, displays the error for a frame or two, then disappears):
Image

Sample Rust code (this is only an example, it's not only this particular error):
(This is in a #[cfg(test)] module.)

impl TestResponse {
...
    pub async fn print(&mut self) {
        let response = self.response;
        todo!()
    }
...
}
cargo check --tests
...
error[E0507]: cannot move out of `self.response` which is behind a mutable reference
  --> api/src/test_helpers/test_response.rs:35:24
   |
35 |         let response = self.response;
   |                        ^^^^^^^^^^^^^ move occurs because `self.response` has type `Response<Body>`, which does not implement the `Copy` trait
...

Here's "Rust Analyzer Language Server Trace" output with rust-analyzer.trace.server: "messages" after Clear, Save, and error flashes briefly (a couple frames) and disappears:

[Trace - 4:21:34 PM] Sending request 'textDocument/formatting - (139)'. [Trace - 4:21:34 PM] Received response 'textDocument/formatting - (139)' in 39ms. [Trace - 4:21:34 PM] Sending notification 'textDocument/didSave'. [Trace - 4:21:34 PM] Received request 'window/workDoneProgress/create - (40)'. [Trace - 4:21:34 PM] Sending response 'window/workDoneProgress/create - (40)'. Processing request took 0ms [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Sending notification 'workspace/didChangeWatchedFiles'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Received notification 'textDocument/publishDiagnostics'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:34 PM] Received notification '$/progress'. [Trace - 4:21:35 PM] Received notification '$/progress'. [Trace - 4:21:35 PM] Received notification 'textDocument/publishDiagnostics'. [Trace - 4:21:35 PM] Sending request 'textDocument/codeAction - (140)'. [Trace - 4:21:35 PM] Received response 'textDocument/codeAction - (140)' in 1ms. [Trace - 4:21:35 PM] Sending request 'textDocument/codeLens - (141)'. [Trace - 4:21:35 PM] Received response 'textDocument/codeLens - (141)' in 2ms.

Here's "Rust Analyzer Language Server Trace" output with rust-analyzer.trace.server: "verbose" after Clear, Save, and error flashes briefly (a couple frames) and disappears:

[Trace - 4:24:42 PM] Sending request 'textDocument/formatting - (162)'. Params: { "textDocument": { "uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs" }, "options": { "tabSize": 4, "insertSpaces": true, "trimTrailingWhitespace": true, "insertFinalNewline": true } }

[Trace - 4:24:42 PM] Received response 'textDocument/formatting - (162)' in 66ms.
No result returned.

[Trace - 4:24:42 PM] Sending notification 'textDocument/didSave'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
}
}

[Trace - 4:24:42 PM] Received request 'window/workDoneProgress/create - (45)'.
Params: {
"token": "rust-analyzer/flycheck/0"
}

[Trace - 4:24:42 PM] Sending response 'window/workDoneProgress/create - (45)'. Processing request took 0ms
No result returned.

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "begin",
"title": "cargo check",
"cancellable": true
}
}

[Trace - 4:24:42 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
"changes": [
{
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"type": 2
},
{
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"type": 2
}
]
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "api"
}
}

[Trace - 4:24:42 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"diagnostics": [
{
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 36
}
},
"severity": 1,
"code": "E0507",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0507"
},
"source": "rustc",
"message": "cannot move out of self.response which is behind a mutable reference\nmove occurs because self.response has type Response<Body>, which does not implement the Copy trait",
"relatedInformation": [
{
"location": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 23
}
}
},
"message": "consider borrowing here: &"
}
],
"data": {
"rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0507]\u001b[0m\u001b[0m\u001b[1m: cannot move out of self.response which is behind a mutable reference\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0mapi/src/test_helpers/test_response.rs:35:24\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m35\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let response = self.response;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mmove occurs because self.response has type Response<Body>, which does not implement the Copy trait\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider borrowing here\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m35\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let response = \u001b[0m\u001b[0m\u001b[38;5;10m&\u001b[0m\u001b[0mself.response;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+\u001b[0m\n\n"
}
},
{
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 23
}
},
"severity": 4,
"code": "E0507",
"codeDescription": {
"href": "https://doc.rust-lang.org/error-index.html#E0507"
},
"source": "rustc",
"message": "consider borrowing here: &",
"relatedInformation": [
{
"location": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"range": {
"start": {
"line": 34,
"character": 23
},
"end": {
"line": 34,
"character": 36
}
}
},
"message": "original diagnostic"
}
]
}
],
"version": 282
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "quick_dev"
}
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "api"
}
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "report",
"cancellable": true,
"message": "api"
}
}

[Trace - 4:24:42 PM] Received notification '$/progress'.
Params: {
"token": "rust-analyzer/flycheck/0",
"value": {
"kind": "end"
}
}

[Trace - 4:24:42 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs",
"diagnostics": [],
"version": 282
}

[Trace - 4:24:43 PM] Sending request 'textDocument/codeAction - (163)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"range": {
"start": {
"line": 36,
"character": 5
},
"end": {
"line": 36,
"character": 5
}
},
"context": {
"diagnostics": [],
"triggerKind": 2
}
}

[Trace - 4:24:43 PM] Received response 'textDocument/codeAction - (163)' in 2ms.
Result: []

[Trace - 4:24:43 PM] Sending request 'textDocument/codeLens - (164)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
}
}

[Trace - 4:24:43 PM] Received response 'textDocument/codeLens - (164)' in 1ms.
Result: [
{
"range": {
"start": {
"line": 7,
"character": 11
},
"end": {
"line": 7,
"character": 23
}
},
"data": {
"version": 282,
"kind": {
"impls": {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"position": {
"line": 7,
"character": 11
}
}
}
}
}
]

[Trace - 4:24:45 PM] Sending request 'textDocument/diagnostic - (165)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/routes/jobs/checkout_job.rs"
},
"previousResultId": "rust-analyzer"
}

[Trace - 4:24:45 PM] Received response 'textDocument/diagnostic - (165)' in 2ms.
Result: {
"kind": "full",
"resultId": "rust-analyzer",
"items": []
}

[Trace - 4:24:45 PM] Sending request 'textDocument/diagnostic - (166)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"previousResultId": "rust-analyzer"
}

[Trace - 4:24:45 PM] Received response 'textDocument/diagnostic - (166)' in 1ms.
Result: {
"kind": "full",
"resultId": "rust-analyzer",
"items": []
}

[Trace - 4:24:45 PM] Sending request 'textDocument/codeLens - (167)'.
Params: {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
}
}

[Trace - 4:24:45 PM] Received response 'textDocument/codeLens - (167)' in 1ms.
Result: [
{
"range": {
"start": {
"line": 7,
"character": 11
},
"end": {
"line": 7,
"character": 23
}
},
"data": {
"version": 282,
"kind": {
"impls": {
"textDocument": {
"uri": "file:///home/tom/apps/a11y.doctor/api/src/test_helpers/test_response.rs"
},
"position": {
"line": 7,
"character": 11
}
}
}
}
}
]

@tgrushka tgrushka added the Broken Window Bugs / technical debt to be addressed immediately label Dec 28, 2024
@Veykril
Copy link
Member

Veykril commented Dec 29, 2024

The flickering diagnostics should be fixed by #18778, as for why the server exits for you I am not sure. Given your gif retains the inlay hints it seems like the server isn't exiting so I assume the logs you picked were misleading / stale (the server will exit if the extension unloads etc)

@Veykril Veykril closed this as completed Dec 29, 2024
@isosphere
Copy link

I've also seen this "Server process excited with code 0" issue on 0.3.2253. My other symptoms on that version are a little different: I would get lints on the first restart of rust-analyzer, but then they would stop updating after that until I restarted it again.

Downgrading to 0.3.2220 resolved the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Broken Window Bugs / technical debt to be addressed immediately
Projects
None yet
Development

No branches or pull requests

3 participants