You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain
Bug description
I've nailed it down to lsp--text-document-did-save, which seems to be blocking occasionally, sometimes it takes as long as a couple of seconds. I've confirmed that it's not caused by the GC kicking in, by testing with (setq garbage-collection-messages t)
Steps to reproduce
M-x lsp-start-plain
Open a Rust file in a medium-sized (>10000LOC) project with lsp-mode
Repeatedly make small changes and save
You may have to repeat these steps tens of times before seeing a stutter
The stutters vary in length, from hundreds to thousands of milliseconds.
Expected behavior
I expected lsp--text-document-did-save to not block.
My hunch is that rust-analyzer occasionally takes a long time to process the didChange message, and will block when processing other input during this time. If a blocking lsp-mode call comes shortly after the non-blocking lsp--text-document-did-save, then that other synchronous call will be blocking the UI, when it would usually be quick. This explains the inconsistent behavior, as it would depend on when the various timers are triggered.
I don't observe this behavior with e.g Zig zls.
If that's the case, one simple hack would be to just stagger those timers after lsp--text-document-did-save, but this is obviously both not robust, and introduces an arbitrary delay to LSP feedback whenever a file is saved (perhaps unnecessarily if rust-analyzer processed the didChange request quickly.)
Which Language Server did you use?
rust-analyzer
OS
Linux
Error callstack
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
snyball
changed the title
Occasional huge stutters when saving files with rust-analyzer
Occasional huge non-GC stutters when saving files with rust-analyzer
Feb 21, 2024
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
I've nailed it down to
lsp--text-document-did-save
, which seems to be blocking occasionally, sometimes it takes as long as a couple of seconds. I've confirmed that it's not caused by the GC kicking in, by testing with(setq garbage-collection-messages t)
Steps to reproduce
M-x lsp-start-plain
>10000LOC
) project with lsp-modeThe stutters vary in length, from hundreds to thousands of milliseconds.
Expected behavior
I expected
lsp--text-document-did-save
to not block.My hunch is that rust-analyzer occasionally takes a long time to process the
didChange
message, and will block when processing other input during this time. If a blocking lsp-mode call comes shortly after the non-blockinglsp--text-document-did-save
, then that other synchronous call will be blocking the UI, when it would usually be quick. This explains the inconsistent behavior, as it would depend on when the various timers are triggered.I don't observe this behavior with e.g Zig zls.
If that's the case, one simple hack would be to just stagger those timers after
lsp--text-document-did-save
, but this is obviously both not robust, and introduces an arbitrary delay to LSP feedback whenever a file is saved (perhaps unnecessarily if rust-analyzer processed thedidChange
request quickly.)Which Language Server did you use?
rust-analyzer
OS
Linux
Error callstack
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: