GNU bug report logs -
#66669
30.0.50; [EGLOT] Emacs freezes when server sends a ton of progress notifications
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Sat, 21 Oct 2023 19:12:02 UTC
Severity: normal
Found in version 30.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66669 in the body.
You can then email your comments to 66669 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#66669
; Package
emacs
.
(Sat, 21 Oct 2023 19:12:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yuan Fu <casouri <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Sat, 21 Oct 2023 19:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: joaotavora <at> gmail.com
I use rust’s language server (rust-analyzer) with eglot. And whenever I turn eglot on for a project, Emacs freezes for a good 30 seconds, busy updating the eglot progress indicator, before I can do anything. I think the reason is that the rust language server sends a ton of progress notifications, which completely blocks Emacs before it’s done.
Setting eglot-report-progress to nil doesn’t help me, presumably because eglot still needs to process the notifications.
I wonder if we can only take a sample of the progress notifications, and ignore the majority, so that Emacs is free to respond to user input?
In the same vain, I wonder if we can instruct Emacs to filter out some messages from the server at process filter level and never call into lisp for these messages, such that some particularly noisy servers (eg, typescript-language-server) won’t slow down Emacs a perceivable amount?
I attached the events log during the start up of eglot in my rust project. As you can see, it sends a dozen notifications per second.
Yuan
[indexing-events.log (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#66669
; Package
emacs
.
(Sat, 21 Oct 2023 21:00:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 66669 <at> debbugs.gnu.org (full text, mbox):
On Sat, Oct 21, 2023 at 8:11 PM Yuan Fu <casouri <at> gmail.com> wrote:
>
> X-Debbugs-CC: joaotavora <at> gmail.com
>
> I use rust’s language server (rust-analyzer) with eglot. And
> whenever I turn eglot on for a project, Emacs freezes for a good
> 30 seconds, busy updating the eglot progress indicator, before I
> can do anything. I think the reason is that the rust language server
> sends a ton of progress notifications, which completely blocks Emacs
> before it’s done.
hi Yuan,
Two things:
* Would be nice to have a reproduction recipe. I have rust-analyzer but
one project where I try it regularly, the "bevy" graphics engine [1]
Seems to work OK there. You say "a project", but for bevy
it starts up fast (maybe not even half a second) and works quite well.
No Emacs freeze at all. Tried removing the cache with git clean -fdx and
I get all the notifications cleanly with no slowdown.
So please include Emacs versions (master preferred, should be trivial
for you), Eglot version, rust-analyzer version and preferably an Emacs
-Q invocation with the simplest Rust project you can share that
exhibits this behaviour.
* Have you profiled? Have you tried setting eglot-events-buffer-size
to 0 (and restart Eglot) as suggested in the Eglot manual? Many
performance problems are due to JSON objects being pretty printed in
the Eglot events buffer (BTW some users ask me to turn it to 0 by
default, but the pros don't outweigh the cons, which in this case is
we would lose a valuable tool for newbie users with exotic servers to
send me their debug data easily)
João
[1] https://github.com/bevyengine/bevy
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#66669
; Package
emacs
.
(Sun, 22 Oct 2023 04:52:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 66669 <at> debbugs.gnu.org (full text, mbox):
> Cc: joaotavora <at> gmail.com
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 21 Oct 2023 12:10:49 -0700
>
> I use rust’s language server (rust-analyzer) with eglot. And whenever I turn eglot on for a project, Emacs freezes for a good 30 seconds, busy updating the eglot progress indicator, before I can do anything. I think the reason is that the rust language server sends a ton of progress notifications, which completely blocks Emacs before it’s done.
>
> Setting eglot-report-progress to nil doesn’t help me, presumably because eglot still needs to process the notifications.
Can't this information be processed in chunks, not in one go?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#66669
; Package
emacs
.
(Sun, 22 Oct 2023 14:51:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 66669 <at> debbugs.gnu.org (full text, mbox):
On Sun, Oct 22, 2023 at 5:50 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > Cc: joaotavora <at> gmail.com
> > From: Yuan Fu <casouri <at> gmail.com>
> > Date: Sat, 21 Oct 2023 12:10:49 -0700
> >
> > I use rust’s language server (rust-analyzer) with eglot. And whenever I turn eglot on for a project, Emacs freezes for a good 30 seconds, busy updating the eglot progress indicator, before I can do anything. I think the reason is that the rust language server sends a ton of progress notifications, which completely blocks Emacs before it’s done.
> >
> > Setting eglot-report-progress to nil doesn’t help me, presumably because eglot still needs to process the notifications.
>
> Can't this information be processed in chunks, not in one go?
Maybe, depending on what that means. I think it's important to
get to the bottom of Yuan's "presumably" first, preferably by
reproducing his problem.
João
Reply sent
to
Yuan Fu <casouri <at> gmail.com>
:
You have taken responsibility.
(Mon, 23 Oct 2023 00:41:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yuan Fu <casouri <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 23 Oct 2023 00:41:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 66669-done <at> debbugs.gnu.org (full text, mbox):
> On Oct 22, 2023, at 7:52 AM, João Távora <joaotavora <at> gmail.com> wrote:
>
> On Sun, Oct 22, 2023 at 5:50 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>>> Cc: joaotavora <at> gmail.com
>>> From: Yuan Fu <casouri <at> gmail.com>
>>> Date: Sat, 21 Oct 2023 12:10:49 -0700
>>>
>>> I use rust’s language server (rust-analyzer) with eglot. And whenever I turn eglot on for a project, Emacs freezes for a good 30 seconds, busy updating the eglot progress indicator, before I can do anything. I think the reason is that the rust language server sends a ton of progress notifications, which completely blocks Emacs before it’s done.
>>>
>>> Setting eglot-report-progress to nil doesn’t help me, presumably because eglot still needs to process the notifications.
>>
>> Can't this information be processed in chunks, not in one go?
>
> Maybe, depending on what that means. I think it's important to
> get to the bottom of Yuan's "presumably" first, preferably by
> reproducing his problem.
Apologize for doubting eglot's ability to process messages :-) When trying to reproduce the problem, I eventually found out that it was project-files that was blocking. And project-files was blocking because I used a custom project method, which doesn’t properly ignore the build directory, which contains a ton of small files.
> * Have you profiled? Have you tried setting eglot-events-buffer-size
> to 0 (and restart Eglot) as suggested in the Eglot manual? Many
> performance problems are due to JSON objects being pretty printed in
> the Eglot events buffer (BTW some users ask me to turn it to 0 by
> default, but the pros don't outweigh the cons, which in this case is
> we would lose a valuable tool for newbie users with exotic servers to
> send me their debug data easily)
I do have eglot-events-buffer-size set to 0. I observed the freeze, reset it to some large value, and saw a bunch of notifications, so I assumed that was the problem. That turns out to be very wrong :-)
Personally I also think the default value should be 0. (I wonder if disabling pp would improve it enough?) Eglot is really borderline non-usable when the value is non-0 and the language server is chatty (eg, rust, typescript). I certainly don’t want people to try out eglot, see the lag, and conclude that “Emacs is slow”.
Maybe providing a simple command like M-x eglot-enable-logging, and tell new users to turn this on and restart eglot, is good enough. But I’m not the one that dealt with eglot bug reports, maybe restarting eglot can’t reproduce the error in many cases?
Yuan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 20 Nov 2023 12:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 264 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.