[Bug]: rust-analyzer-proc-macro-srv
segfault
#23087
Labels
bug report
Something is not working properly
rust
Any problem related to the Rust ecosystem (including cargo)
Problem description
I've run in to a very weird issue.
rust-analyzer-proc-macro-srv
, the program shipped with therust
package and used byrust-analyzer
to resolve and expand proc macros, would crash with a segfault signal (11
) when being used in a repo with a certain combination of crates.I was first hit with this issue more than a week ago but it's been really hard to debug. I made a "minimal" reproducer here but it looks far from actually minimal. I couldn't trim it further as any single dependency or line of code removed would result in the crash not happening.
Note
Yes, the repo does not compile. But that's irrelevant. I originally encountered this issue on a much larger repo that compiles totally fine. Also, even on repos that do not compile, the process should apparently not segfault.
I managed to extract the hundreds of raw messages that
rust-analyzer
sends torust-analyzer-proc-macro-srv
and recreated the setup outside of the context ofrust-analyzer
. Then, I used a trial-and-error appraoch to filter out most messages to arrive at a sequence of 23 messages. Removing any of these 23 messages results in the crash not happening.I'm not posting the "distilled" reproducer yet as it involves referencing the compiled binaries (needed by
rust-analyzer-proc-macro-srv
to run the expansion), and those depend strictly on Rust ABI versions, so using the full reproducer might be the easiest way to see the error.Nevertheless, the fact that you have to send 23 messages in a sequence to crash the server is quite fascinating... and a huge headache to debug. The root cause might be quite deep.
What steps will reproduce the bug?
Run
helix
in this repo:xJonathanLEI/termux-proc-macro-srv-crash-repro
and wait forrust-analyzer-proc-macro-srv
to crash:What is the expected behavior?
rust-analyzer-proc-macro-srv
does not segfault.System information
The text was updated successfully, but these errors were encountered: