Skip to content

Rust Analyzer Language Server crashes on big Rust files on VSCode. #18223

@AngheloAlf

Description

@AngheloAlf

The Rust Analyzer extension crashes when opening a big Rust file.
This file is 24000 lines long and only contain test code. I had to move all this test code to its own file because it was messing with the analyzer extension.
The extension works fine if I completely ignore this file and don't open at all.

Here's a link to the file that produces Rust Analyzer to crash: https://github.com/Decompollaborate/rabbitizer/blob/8a429c863e2c451b47bc0fe74a4e6a776f470356/src/rabbitizer/tests/instruction_tests_r4000allegrex.rs

The only "workaround" I can find for the analyzer crashing is to restart the rust analyzer server or restart all vscode extensions by doing ctrl-shift-P and select rust-analyzer: Restart server or Developer: Restart extension host respectively. After the extension is restarted it will crash again if I still have the file open though.

I saw there are other issues mentioning problems with big files (ie #13807 ), but most of them mention OOM or the extension eating all the RAM, but I did not notice any significant difference on the RAM usage when this issue happens.

To reproduce:

Minimized repo

I made a "minimized" repo that still reproduces the issue: https://github.com/AngheloAlf/rust_analyzer_crash
The problematic file is at https://github.com/AngheloAlf/rust_analyzer_crash/blob/big_file_crash/src/big_tests.rs

When the analyzer crashes vscode shows the following pop-up:
Image

This is all the logs the OUTPUT tab has:


thread 'Worker' has overflowed its stack
fatal runtime error: stack overflow
[Info  - 11:26:42] Connection to server got closed. Server will restart.
true

thread 'Worker' has overflowed its stack
fatal runtime error: stack overflow
[Info  - 11:26:51] Connection to server got closed. Server will restart.
true

thread 'Worker' has overflowed its stack
fatal runtime error: stack overflow
[Info  - 11:27:01] Connection to server got closed. Server will restart.
true

thread 'Worker' has overflowed its stack
fatal runtime error: stack overflow
[Info  - 11:27:10] Connection to server got closed. Server will restart.
true

thread 'Worker' has overflowed its stack
fatal runtime error: stack overflow
[Error - 11:27:20] The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Versions info

cargo --version: cargo 1.81.0 (2dbb1af80 2024-08-20)
VSCode version: 1.93.1
rust-analyzer vscode extension version: v0.3.2129
OS: Pop!_OS 22.04

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions