Skip to content

Rust-analyzer hangs for more than 1 minute after indexing before responding to LSP requests #18969

Open
@stormshield-kg

Description

@stormshield-kg

Logs output using RA_PROFILE='*>10': log1.txt
Logs output using RA_PROFILE='*: log2.txt

Perf run showing the problem (viewable using Firefox profiler): perf.tar.gz
The first 30s are the indexing time, then rust-analyzer hangs for 75s when trying to hover a struct or go to its definition.

rust-analyzer version: v0.4.2270
rustc version: rustc 1.83.0 (90b35a623 2024-11-26)

editor or extension: VSCode 1.96.3 with rust-analyzer extension v0.4.2270

Reproduction: This problem occurs on a private repository which I cannot share. It uses diesel extensively.

Activity

ChayimFriedman2

ChayimFriedman2 commented on Jan 18, 2025

@ChayimFriedman2
Contributor

It doesn't seem to hang, just doing a lot of work. Indexing isn't the end of the story; it doesn't do all the work (nor it should). And diesel is known to use the trait solver extensively. So I believe this is unactionable.

Do next hovers also take that long?

stormshield-kg

stormshield-kg commented on Jan 18, 2025

@stormshield-kg
Author

Next hovers are fast only if the code doesn't change, but they are slow again after any code modification.

stormshield-kg

stormshield-kg commented on Jan 18, 2025

@stormshield-kg
Author

The slowdown didn't occur several months ago, so it might be caused by a relatively recent change in rust-analyzer.

Foorack

Foorack commented on May 18, 2025

@Foorack

Running into this as well. Stuck at "Indexing 240/353 (myproj_abc)".

Not sure if it is actually "stuck", or just deeply processing something (RA_LOG=info doesn't help), but this did not happen a few months ago. I'll see if I can rollback the VSCode extension and find the point it degrades.

ChayimFriedman2

ChayimFriedman2 commented on May 18, 2025

@ChayimFriedman2
Contributor

@Foorack Yours is probably #19790.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Foorack@ChayimFriedman2@stormshield-kg

        Issue actions

          Rust-analyzer hangs for more than 1 minute after indexing before responding to LSP requests · Issue #18969 · rust-lang/rust-analyzer