Hi! rust-analyzer crashes very often for me. I've already installed a debug build, but don't know how to obtain a backtrace. I'm using ra from vscode, and running that from a terminal, even with
-w, produces no output when the extension host crashes. Also the ra logs under
.config/Code/logs/*/exthost1/output_logging_*/*-Rust* are mostly empty (no backtraces). I'm using arch linux. Help?
How did you install the debug build?
cargo xtask install?
Did you set
I usually build the server with
debug = 2 via
cargo build and then open an extension host that uses the built language server in VSCode debugger. You can refer to this video where I recorded debugging process of a certain bug.
Also very important, make sure to run
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope to enable
ptrace of non-child processes
We should refresh debugging.md file, though the only thing that changed there is the name of debug configs.
mostly unrelated, but there's also a
ra_prof::print_backtrace function which just dumps current backtrace to stderr.
Yes, I installed via
cargo xtask install. I set
RUST_BACKTRACE=full, but I don't get any output whatsoever
I'm not running ra in a debugger, do I have to do that?
@jplatte if you want a backtrace only, you need to switch debug symbols on here set
debug = 2. @matklad I am I correct, that
cargo xtask install does the debug build?
I did that
Oh wait, I did for the release profile
So, what do you see in vscode Output tab
Rust Analyzer Language Server?
that output tab disappears once the extension host crashes
And the log files on disk for that are empty:
-rw-r--r-- 1 jplatte jplatte 0 4. Feb 16:37 '.config/Code/logs/20200204T163721/exthost1/output_logging_20200204T163725/1-Rust Analyzer Language Server Trace.log' -rw-r--r-- 1 jplatte jplatte 0 4. Feb 16:38 '.config/Code/logs/20200204T163721/exthost1/output_logging_20200204T163837/1-Rust Analyzer Language Server Trace.log' -rw-r--r-- 1 jplatte jplatte 0 4. Feb 16:38 '.config/Code/logs/20200204T163721/exthost1/output_logging_20200204T163847/1-Rust Analyzer Language Server Trace.log'
Hmm, are you sure this is the language server crashing, not the vscode TypeScript extension? It would be helpful to see what happens
VSCode says "Extension host terminated unexpectedly"
Can you show the output of
git log --oneline in your local rust-analyzer repo?
Oh wow, found the issue
It wasn't actually ra that crashed, but the treesitter extension. I haven't seen it crash in quite some time, and I wonder why it's so crashy when ra is enabled at the same time
Since I was convinced it was ra's fault, I only looked for backtraces in the dev tools, but this time I looked closer and saw that there was a reference to the treesitter extension. So I disabled that and then it stopped crashing...