Open jmcphers opened 2 weeks ago
The LSP server is dropped when the connection closes, which in turn closes all transmission channels to the LSP. So when read_console()
refreshes LSP inputs by sending data with an unwrap, we crash.
None
.Actually Ark already handles the LSP reconnection cycle correctly. The problem arises when there are multiple LSP connections at the same time. We're a bit far off from supporting multiple connections but we probably don't have to right now since the jupyter-adapter path doesn't have this issue with refreshes while busy. (But when that happens we should at least panic earlier with a better error message, or ignore the request.)
Ark is getting redundant requests to start the LSP from kallichore. I also see a ton of requests to start the UI comms, e.g.:
[R] 2024-10-10T16:30:24.846565Z INFO Received request for open comms: JupyterMessage { zmq_identities: [[114, 45, 54, 51, 48, 50, 57, 97, 98, 100], [114, 45, 54, 51, 48, 50, 57, 97, 98, 100]], header: JupyterHeader { msg_id: "250f1e6813", session: "r-63029abd", username: "lionel", date: "2024-10-10T16:30:24.845Z", msg_type: "comm_info_request", version: "5.3" }, parent_header: None, content: CommInfoRequest { target_name: "positron.help" } }
[R] at crates/amalthea/src/socket/shell.rs:275
[R]
[R] 2024-10-10T16:30:24.846660Z INFO Sending UI message to frontend: Event(WorkingDirectory(WorkingDirectoryParams { directory: "~/Sync/Projects/R/r-lib/carrier" }))
[R] at crates/ark/src/kernel.rs:132
[R]
[R] 2024-10-10T16:30:24.846808Z ERROR Error receiving Positron event; closing event listener: RecvError
[R] at crates/ark/src/ui/ui.rs:70
[R]
[R] 2024-10-10T16:30:24.846826Z INFO Comm channel opened; there are now 277 open comms
[R] at crates/amalthea/src/comm/comm_manager.rs:118
[R]
System details:
Positron and OS details:
Interpreter details:
Any R.
Describe the issue:
If Positron tries to reattach to R when R is busy, R panics and crashes.
Steps to reproduce the issue:
Sys.sleep(30)
.Positron waits to attach to R until it is finished executing the sleep command (expected). However, once attached, R crashes with the exit code -1.
https://github.com/user-attachments/assets/3d40dcb6-ab91-4f43-aef1-26e2657c5113
Expected or desired behavior:
No crash.
Were there any error messages in the UI, Output panel, or Developer Tools console?
Yes: