Stream: t-compiler/wg-rls-2.0

Topic: obtaining backtraces


jplatte (Feb 04 2020 at 11:36, on Zulip):

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?

std::Veetaha (Feb 04 2020 at 11:50, on Zulip):

How did you install the debug build? cargo xtask install?

bjorn3 (Feb 04 2020 at 11:51, on Zulip):

Did you set RUST_BACKTRACE=1?

std::Veetaha (Feb 04 2020 at 11:58, on Zulip):

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.

std::Veetaha (Feb 04 2020 at 12:00, on Zulip):

Also very important, make sure to run echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope to enable ptrace of non-child processes

std::Veetaha (Feb 04 2020 at 12:04, on Zulip):

We should refresh debugging.md file, though the only thing that changed there is the name of debug configs.

matklad (Feb 04 2020 at 12:19, on Zulip):

mostly unrelated, but there's also a ra_prof::print_backtrace function which just dumps current backtrace to stderr.

jplatte (Feb 04 2020 at 15:27, on Zulip):

Yes, I installed via cargo xtask install. I set RUST_BACKTRACE=full, but I don't get any output whatsoever

jplatte (Feb 04 2020 at 15:28, on Zulip):

I'm not running ra in a debugger, do I have to do that?

std::Veetaha (Feb 04 2020 at 15:35, on Zulip):

@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?

jplatte (Feb 04 2020 at 15:35, on Zulip):

I did that

jplatte (Feb 04 2020 at 15:35, on Zulip):

Oh wait, I did for the release profile

std::Veetaha (Feb 04 2020 at 15:36, on Zulip):

So, what do you see in vscode Output tab Rust Analyzer Language Server?

jplatte (Feb 04 2020 at 15:38, on Zulip):

that output tab disappears once the extension host crashes

jplatte (Feb 04 2020 at 15:42, on Zulip):

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'
std::Veetaha (Feb 04 2020 at 15:44, on Zulip):

Hmm, are you sure this is the language server crashing, not the vscode TypeScript extension? It would be helpful to see what happens

jplatte (Feb 04 2020 at 15:45, on Zulip):

VSCode says "Extension host terminated unexpectedly"

std::Veetaha (Feb 04 2020 at 15:47, on Zulip):

Can you show the output of git log --oneline in your local rust-analyzer repo?

jplatte (Feb 04 2020 at 15:47, on Zulip):

Oh wow, found the issue

jplatte (Feb 04 2020 at 15:47, on Zulip):

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

jplatte (Feb 04 2020 at 15:55, on Zulip):

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 disbaled that and then it stopped crashing...

Last update: Jun 07 2020 at 10:35UTC