Replies: 4 comments 6 replies
-
I have encountered the same problem when using clangd and pyright. After a few dig, I find this:
I think it may be the "jsonrpc" or "eglot" does not maintain a good context and leak some process information. I try to do some clean up on "elgot--servers-by-project" but failed. ( I do not know how to extract the process info from "eglot--servers-by-project" and check whether this server still exists, then delete or kill it) |
Beta Was this translation helpful? Give feedback.
-
I forgot to convert this issue worth insufficient information into a discussion back then. Doing it now. It's fine to have a speculative conversation of course, but I can't do much debugging or spend time on this until I have a consistent repro. |
Beta Was this translation helpful? Give feedback.
-
When I had a similar situation, it was probably because eglot-shutdown wasn't successful, and the file-notification handlers wasn't cleared. So, even when Eglot opened a new connection to the server, the file-notification handlers wanted to use the old, dead connection. I extracted the notification id from the backtrace and manually called file-notify-rm-watch. Also eglot--servers-by-project contained two entries for the same major-mode/project pair. The next time it happens, I'll try to understand how Eglot ends up in a bad state. |
Beta Was this translation helpful? Give feedback.
-
Hi, I encountered similar situation around this issue. I would like to post what I've found. Hopefully it could help further investigation. ProblemWhen shutting down an eglot lsp server, it hang there with messaging
PostmortemEnvironment
Reproducing
DebugBy setting
It is found that the Mitigation/ResolutionWrapping the --- eglot.origin.el 2024-02-25 23:25:02.000000000 +0800
+++ eglot.el 2024-02-25 22:58:22.000000000 +0800
@@ -1140,7 +1140,8 @@
(eglot--request server :shutdown nil :timeout (or timeout 1.5))
(jsonrpc-notify server :exit nil))
;; Now ask jsonrpc.el to shut down the server.
- (jsonrpc-shutdown server (not preserve-buffers))
+ (with-timeout ((or timeout 1.5) (eglot--message "JSON RPC shutting down is timeout."))
+ (jsonrpc-shutdown server (not preserve-buffers)))
(unless preserve-buffers (kill-buffer (jsonrpc-events-buffer server)))))
(defun eglot-shutdown-all (&optional preserve-buffers) Reference |
Beta Was this translation helpful? Give feedback.
-
Config
Explanation
I ran into some eglot-related bug:
which froze my entire python buffer. I didn't mean to report this bug, but just restart eglot and continue with my work, so I attempted to do that. Unfortunately the shutdown didn't work, so this bug report is solely about the shutdown. I wouldn't know how to reproduce this state because I'm not sure how I got into the first error in the first place.
What I would like though, is some guidance/method on how to recover from such a severe error related to eglot. In my case, I don't see a way to stop eglot, and I can't get another working buffer of the file I was working on - restarting Emacs was the only thing I found that worked.
LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)
Unfortunately I killed all eglot-related buffers trying to get out of the situation (which didn't help), so I don't have this. I imagine this error is rare, so I won't try to reproduce right now lest I also lose the backtrace. Will update if it happens again.
Backtrace (mandatory, unless no error message seen or heard):
Minimal configuration (mandatory)
I wouldn't know how to reproduce right now, but will add this if it ever occurs again. Again, the focus here is on some method that would kill/restart eglot if something went awry (and the shutdown commands cease working), regardless of config.
Beta Was this translation helpful? Give feedback.
All reactions