rust-analyzer: Rust-analyzer VSCode plugin stuck while fetching
Rust-analyzer stopped working for me a few days ago. I think it was after upgrading to the latest plugin version. Rust-analyzer shows: “Fetching” with a spinner indefinitely. Sometimes I have gotten it to show “Fetching: metadata”.
I can replicate this in an empty project just after running cargo init mytestproject.
I have tried these steps:
- Downgrading to the previous version of the plugin: this first failed because it would never download the binary, it would just show something like “binary for XXX is not downloaded”, but clicking the button did nothing. I downloaded the binary for that version manually and pointed the config to use it and that worked, but it gets stuck in the same way.
- I’ve deleted
~/.cargo/registryand~/.cargo/git. - I’ve made sure rust is up-to-date:
rustup update. - I have removed all my rust-analyzer specific settings from vscode.
- I’ve checked the rust-analyzer logs. They don’t seem to show anything weird. The latest messages for the various logs are:
[DEBUG lsp_server::msg] > {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching"}}}
[DEBUG lsp_server::msg] < {"jsonrpc":"2.0","id":1,"result":null}
[INFO rust_analyzer::main_loop] handle_event(Response(Response { id: RequestId(I32(1)), result: None, error: None }))
[Trace - 11:52:16 AM] Received request 'window/workDoneProgress/create - (1)'.
Params: {
"token": "rustAnalyzer/Fetching"
}
[Trace - 11:52:16 AM] Sending response 'window/workDoneProgress/create - (1)'. Processing request took 0ms
No result returned.
[Trace - 11:52:16 AM] Received notification '$/progress'.
Params: {
"token": "rustAnalyzer/Fetching",
"value": {
"kind": "begin",
"title": "Fetching"
}
}
INFO [6/23/2021, 11:52:16 AM]: PersistentState: {
lastCheck: undefined,
nightlyReleaseId: undefined,
serverVersion: undefined
}
INFO [6/23/2021, 11:52:16 AM]: Using server binary at /home/arong/Downloads/rust-analyzer-x86_64-unknown-linux-gnu
- I have tried to run the
analysis-statscommand, and it seems to work ok (except for some performance counters):
Failed to create perf counter: Operation not permitted (os error 1)
Database loaded: 552.02ms
Failed to create perf counter: Operation not permitted (os error 1)
crates: 1, mods: 1, decls: 1, fns: 1
Item Collection: 1.26s
Failed to create perf counter: Operation not permitted (os error 1)
exprs: 10, ??ty: 0 (0%), ?ty: 0 (0%), !ty: 0
Inference: 625.89ms
Total: 1.89s
I’m lost as to how to debug this further. Any suggestions about where to look would be helpful.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (6 by maintainers)
I also encountered a similar problem, my solution is
rm -rf ~/.cargo/.package-cachethen restarted vscode and it returned to normalTried to isolate the extension which causes the issue and in my setup disabling
icsharpcode.ilspy-vscodefixes the issues with rust-analyzer.Heh, another thing. Some logging in rust-analyzer might benefit from buffering. It’s emitting tiiiny syscall writes right now:
Thanks @bjorn3 for the quick response.
No hang.
Nothing unusual there, I think. I tried killing those processes and restarting vscode, and I get the same 2 processes.