~30s hangs in diagnostic updates #20570
Unanswered
andreaskrath
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Do you have debug logging enabled? That can slow down r-a quite significantly. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Can you set the environment variable |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am experiencing upwards of 30 seconds hangs after a write a file, until all diagnostics have correctly applied and rust-analyzer stops working and analyzing my submitted code.
I have tested different configurations for rust-analyzer (my normal config, and full default config), and different editors (Neovim, Helix, and VSCode) and they all have the same issue.
Below I have attached some Neovim LSP logs that showcases a delay of about 30 seconds before the communication fully finishes - granted I do not fully understand what these messages are about, I can just observe than when the last messages are received, is when rust-analyzer stops working, and the diagnostics are correctly applied.
Neovim LSP logs
I work with quite a few macros in my code, mostly sqlx and serde derives, and from my primitive testing this issue of hanging is essentially resolved if I remove these macros (although due to functionality this is not really reasonable to do).
When I check rust-analyzer logs, I see a bunch of logs related to
shim
which I do not know what is, but some examples are:attrs_shim
impl_items_with_diagnostics_shim
generic_predicates_shim
impl_datum_shim
struct_signature_with_source_map_shim
And many many more, there are also a few without the
shim
suffix, though not a lot.Looking at the rust-analyzer logs for this (I may have missed something here as the log file for this very small check and example is over 600k lines), there seems to be a couple of seconds of indexing when I open the editor (~10 seconds), which is very reasonable.
When I write my file, and a new request begins I see the following:
01:43:11.139988574
new request starts (at least I think so, there is a major time-gap before the previous log to this log), this is at around line 187k in the log file01:43:52.20375824
the request is done processing, this is at around line 614k in the log file614109
to line614830
around 25-30 seconds is spent only on trait solving essentially, at least the only log message I see for this section istrait_solve_shim(<id>): executing query
I know that these time stamps do not match the Neovim LSP timestamps, as I recorded these at different times - but I am testing the same file change in both scenarios, and the "feel" is exactly the same in both scenarios.
Sorry for the "rant", but I want to provide as much information as possible. My question really is quite simple, I am wondering if this is the expected behaviour. I know that trait solving is very complex, but outside of my code using the sqlx and serde derive macros, it is a relatively lean project I would say, at least in comparison to a lot of other projects I have seen.
I am wondering if there is anything I could do to improve this on my end, because it kills a lot of my workflow that I have to wait around 30 seconds on each file save to get diagnostics for my changes. It also somewhat confuses me why indexing can somehow be relatively fast, although I assume some things are cached here, when the trait solving afterwards is to incredibly slow.
I am not using the new trait solver.
Thanks in advance for anyone who takes the time to read this, and provides any feedback or help. It is greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions