rust-lang / rust-lang/rust-analyzer

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

Open
#18,969 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with log1.txt and log2.txt using the reported RA_PROFILE settings, then inspect perf.tar.gz in Firefox Profiler. Focus on the transition after indexing and the delayed hover or go-to-definition LSP requests, using the Diesel-heavy reproduction context as available. Done means identifying and addressing the cause of the post-indexing hang, with those requests responding normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.