-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R: Crashes in LSP main loop #5321
Comments
Unfortunately the only way to do that is to send a Shutdown request followed by an Exit notification from the client (also depends on ebkalderon/tower-lsp#399 being fixed, we can use The correct fix from Ark's viewpoint would be to refuse to start an LSP until the existing one has been disposed of, but we can't do that while the frontend creates multiple LSP sessions (only because of those zombie extension hosts IIUC?). So let's just add the guardrails around global state that your proposed in the linked PR. |
But then it's possible for older LSPs to send log messages and notifications (publish diagnostics) via the currently active LSP, which could be quite confusing. So I guess we should make that offending global state local. It was mostly made global for the convenience of using free functions/macros for log messages. Other solutions: If we move the LSP out of the kernel and into its own process this will all be much simpler. The lifecycle of the LSPs will be fully managed by VSCode and we can guarantee there's only one session per process. The other way would be to replace tower-lsp by https://github.com/rust-lang/rust-analyzer/tree/master/lib/lsp-server because then we'd be in full control of the LSP event loop and we would be able to forcibly shut it down from the server, making sure there's only one session alive at a time. |
I also saw this locally:
|
Hmm... I believe I'm on a version of Ark with the fix. This may be a separate bug. |
We aren't seeing this anymore in PTD . . will re-open if we see it again. I also ran several R restart tests and all work as expected. |
No repro yet, but multiple folks have observed R crashes in the LSP main loop, especially on Workbench. Here's what the UI looks like when this happens:
And here's a stack trace:
A Slack thread in which @Trevor-Reid mentioned this crash: https://positpbc.slack.com/archives/C07V12KUZLG/p1731000667301089
There was a proposed fix for this in posit-dev/ark#617 (though it was ultimately not committed), and some discussion there about the problem. The right fix here may require work in Ark to better manage LSP state (e.g. to ensure only one session is active at a time, and gracefully shut down an existing LSP session with its event loops when a new one is requested)
Related to posit-dev/ark#622.
The text was updated successfully, but these errors were encountered: