"Connection to server got closed" when restarting the R session
System details:
Positron and OS details:
Positron Version: 2025.05.0 build 142 Code - OSS Version: 1.99.0 Commit: 17df8dd67df471d39688fc6cd02e3f23543b4d72 Date: 2025-05-05T15:48:36.203Z Electron: 34.3.2 Chromium: 132.0.6834.210 Node.js: 20.18.3 V8: 13.2.152.41-electron.0 OS: Linux x64 6.11.0-21-generic
Interpreter details:
R 4.5.0
Describe the issue:
There is an error popup "Connection to server got closed. Server will not be restarted" every time I restart the R session.
The button "Go to output" also doesn't work but I suppose it's the same as https://github.com/posit-dev/positron/issues/6408 (which is still happening).
Steps to reproduce the issue:
Screencast from 2025-05-07 23-17-56.webm
Expected or desired behavior:
No popup
Were there any error messages in the UI, Output panel, or Developer Tools console?
From "R 4.5.0: Kernel":
R] 2025-05-07T21:24:41.468006Z ERROR Error receiving Positron event; closing event listener: RecvError
[R] at crates/ark/src/ui/ui.rs:70
[R]
[R] 2025-05-07T21:24:41.468056Z ERROR Error receiving internal Help message: RecvError
[R] at crates/ark/src/help/r_help.rs:127
I just tried this on Ubuntu 22 (on Posit Workbench) and the restart works correctly. We'll check out Linux desktop to see if we can reproduce.
We also tested this out on Ubuntu 24 x86 desktop and see the restart behaving correctly.
@etiennebacher is this one a new problem with the latest release or did you see it also with older versions from https://github.com/posit-dev/positron/releases?
I tested with several releases:
- 2025.02.0 build 171: no error message
- 2025.04.0 build 250: error message
- 2025.05.0 build 142 (original post): error message
And just to rule out some potential causes, this happens with R 4.4.1, 4.4.3, and 4.5.0.
Do you have any Python environments installed? Do they demonstrate the same problems with restarting?
Can you say more about your Linux install?
I recreated this in my Ubuntu 24.04 arm64 VM using R 4.3.3. These were my steps to reproduce:
- Execute some code (I ran
plot(1:10)) - Restart the session
If I didn't execute any code, I wouldn't get the error.
Can we ensure this is not causing the LSP to break?
Do you have any Python environments installed? Do they demonstrate the same problems with restarting?
I have Python 3.12.3. When I create a new Python project from scratch, I can restart the console without any issue.
For R, I just create a new R project from scratch, restart the console, and I get this popup (I don't even have to type any code).
Can you say more about your Linux install?
It's quite standard, nothing really particular:
OS: Ubuntu 24.04.2 LTS x86_64
Kernel: 6.11.0-21-generic
I don't really know what else to provide, let me know if you need specific info.
Here's the "Output" tab for Console
2025-05-21 22:23:49.135 [info] Restarting
2025-05-21 22:23:49.135 [warning] LSP startup timed out during interpreter restart
2025-05-21 22:23:49.135 [debug] Queuing LSP deactivation. Reason: restarting session. Queue size: 0, pending: 0
2025-05-21 22:23:49.135 [debug] LSP deactivation started. Reason: restarting session. Queue size: 0, pending: 1
2025-05-21 22:23:49.135 [info] Stopping Positron LSP server
2025-05-21 22:23:49.137 [debug] Positron LSP server stopped
2025-05-21 22:23:49.160 [debug] <<< RECV shutdown_reply [control]: {"restart":true,"status":"ok"}
2025-05-21 22:23:49.202 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"shutdown_request"}}
2025-05-21 22:23:49.202 [debug] State: idle => busy (shutdown_request)
2025-05-21 22:23:49.202 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:49.202 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"shutdown_request"}}
2025-05-21 22:23:49.202 [debug] State: busy => idle (shutdown_request)
2025-05-21 22:23:49.203 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:49.203 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"exited","reason":"child process exited"}}
2025-05-21 22:23:49.203 [debug] State: idle => exited (child process exited)
2025-05-21 22:23:49.203 [debug] Queuing LSP deactivation. Reason: session exited. Queue size: 0, pending: 0
2025-05-21 22:23:49.203 [debug] LSP deactivation started. Reason: session exited. Queue size: 0, pending: 1
2025-05-21 22:23:49.203 [debug] LSP already deactivated
2025-05-21 22:23:49.203 [debug] <<< RECV [kernel]: {"kind":"kernel","exited":0}
2025-05-21 22:23:49.204 [info] Kernel exited with code 0; waiting for restart to finish.
2025-05-21 22:23:49.204 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"starting","reason":"start API called"}}
2025-05-21 22:23:49.204 [debug] State: exited => starting (start API called)
2025-05-21 22:23:49.204 [info] The kernel has started up after a restart.
2025-05-21 22:23:49.204 [debug] <<< RECV [kernel]: {"kind":"kernel","handshakeCompleted":["r-af39e245",{"control_port":45465,"shell_port":46355,"stdin_port":37537,"hb_port":43457,"iopub_port":43907,"signature_scheme":"hmac-sha256","key":"5ea6cf52dfc13274842e9e82d68826dc","transport":"tcp","ip":"127.0.0.1"}]}
2025-05-21 22:23:49.262 [debug] >>> SEND comm_info_request [shell]: {"target_name":"positron.dataExplorer"}
2025-05-21 22:23:49.983 [info] Kernel is ready.
2025-05-21 22:23:49.983 [debug] State: starting => ready (restart complete)
2025-05-21 22:23:49.983 [debug] Starting DAP server positron-dap-r-4de677d9 for 127.0.0.1
2025-05-21 22:23:49.984 [debug] >>> SEND comm_open [shell]: {"target_name":"positron.dap","comm_id":"positron-dap-r-4de677d9","data":{"ip_address":"127.0.0.1"}}
2025-05-21 22:23:49.984 [debug] Queuing LSP activation. Reason: foreground session is ready. Queue size: 0, pending: 0
2025-05-21 22:23:49.984 [debug] LSP activation started. Reason: foreground session is ready. Queue size: 0, pending: 1
2025-05-21 22:23:49.984 [info] Starting Positron LSP server
2025-05-21 22:23:49.984 [info] Starting LSP server positron-lsp-r-659d44fc for 127.0.0.1
2025-05-21 22:23:49.984 [debug] >>> SEND comm_open [shell]: {"target_name":"positron.lsp","comm_id":"positron-lsp-r-659d44fc","data":{"ip_address":"127.0.0.1"}}
2025-05-21 22:23:49.985 [debug] <<< RECV iopub_welcome [iopub]: {"subscription":""}
2025-05-21 22:23:49.986 [debug] <<< RECV status [iopub]: {"execution_state":"starting"}
2025-05-21 22:23:49.986 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"kernel_info_request"}}
2025-05-21 22:23:49.986 [debug] State: ready => idle (kernel_info_request)
2025-05-21 22:23:49.986 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:49.986 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_info_request"}}
2025-05-21 22:23:49.986 [debug] State: idle => busy (comm_info_request)
2025-05-21 22:23:49.986 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:49.986 [debug] <<< RECV comm_info_reply [shell]: {"comms":{},"status":"ok"}
2025-05-21 22:23:49.986 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_info_request"}}
2025-05-21 22:23:49.986 [debug] State: busy => idle (comm_info_request)
2025-05-21 22:23:49.986 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:49.987 [debug] >>> SEND comm_open [shell]: {"target_name":"positron.ui","comm_id":"positron-ui-r-18-1e4c5884","data":{}}
2025-05-21 22:23:49.988 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_open"}}
2025-05-21 22:23:49.988 [debug] State: idle => busy (comm_open)
2025-05-21 22:23:49.988 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:49.988 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_open"}}
2025-05-21 22:23:49.988 [debug] State: busy => idle (comm_open)
2025-05-21 22:23:49.988 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:49.988 [debug] <<< RECV comm_msg [iopub]: {"comm_id":"positron-dap-r-4de677d9","data":{"content":{"port":38747},"msg_type":"server_started"}}
2025-05-21 22:23:49.988 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_open"}}
2025-05-21 22:23:49.988 [debug] State: idle => busy (comm_open)
2025-05-21 22:23:49.988 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:49.988 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_open"}}
2025-05-21 22:23:49.988 [debug] State: busy => idle (comm_open)
2025-05-21 22:23:49.988 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:49.988 [debug] <<< RECV comm_msg [iopub]: {"comm_id":"positron-lsp-r-659d44fc","data":{"content":{"port":38391},"msg_type":"server_started"}}
2025-05-21 22:23:49.989 [info] Starting Positron LSP client on port 38391
2025-05-21 22:23:49.990 [debug] >>> SEND comm_info_request [shell]: {"target_name":"positron.help"}
2025-05-21 22:23:49.990 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_open"}}
2025-05-21 22:23:49.990 [debug] State: idle => busy (comm_open)
2025-05-21 22:23:49.991 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:49.991 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_open"}}
2025-05-21 22:23:49.991 [debug] State: busy => idle (comm_open)
2025-05-21 22:23:49.991 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:49.991 [debug] >>> SEND comm_open [shell]: {"target_name":"positron.variables","comm_id":"positron-variables-r-19-1f438a9b","data":{}}
2025-05-21 22:23:49.991 [debug] <<< RECV comm_info_reply [shell]: {"comms":{},"status":"ok"}
2025-05-21 22:23:49.998 [info] Set initial console width to 53
2025-05-21 22:23:49.998 [debug] >>> SEND comm_msg [shell]: {"comm_id":"positron-ui-r-18-1e4c5884","data":{"jsonrpc":"2.0","method":"call_method","params":{"method":"setConsoleWidth","params":[53]}}}
2025-05-21 22:23:50.001 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_info_request"}}
2025-05-21 22:23:50.002 [debug] State: idle => busy (comm_info_request)
2025-05-21 22:23:50.002 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:50.002 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_info_request"}}
2025-05-21 22:23:50.002 [debug] State: busy => idle (comm_info_request)
2025-05-21 22:23:50.002 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:50.003 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_open"}}
2025-05-21 22:23:50.003 [debug] State: idle => busy (comm_open)
2025-05-21 22:23:50.003 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:50.006 [debug] >>> SEND comm_open [shell]: {"target_name":"positron.help","comm_id":"positron-help-r-20-6ac7e6d7","data":{}}
2025-05-21 22:23:50.008 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_open"}}
2025-05-21 22:23:50.008 [debug] State: busy => idle (comm_open)
2025-05-21 22:23:50.009 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:50.009 [debug] <<< RECV comm_msg [iopub]: {"comm_id":"positron-ui-r-18-1e4c5884","data":{"method":"prompt_state","params":{"continuation_prompt":"+ ","input_prompt":"> "}}}
2025-05-21 22:23:50.009 [debug] <<< RECV comm_msg [iopub]: {"comm_id":"positron-ui-r-18-1e4c5884","data":{"method":"working_directory","params":{"directory":"~/Desktop/Git/my-r-project"}}}
2025-05-21 22:23:50.009 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_msg"}}
2025-05-21 22:23:50.009 [debug] State: idle => busy (comm_msg)
2025-05-21 22:23:50.009 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:50.009 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_msg"}}
2025-05-21 22:23:50.010 [debug] State: busy => idle (comm_msg)
2025-05-21 22:23:50.010 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
2025-05-21 22:23:50.010 [debug] <<< RECV comm_msg [iopub]: {"comm_id":"positron-variables-r-19-1f438a9b","data":{"method":"refresh","params":{"length":0,"variables":[],"version":1}}}
2025-05-21 22:23:50.010 [debug] <<< RECV comm_msg [iopub]: {"comm_id":"positron-ui-r-18-1e4c5884","data":{"method":"CallMethodReply","result":80}}
2025-05-21 22:23:50.047 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"busy","reason":"comm_open"}}
2025-05-21 22:23:50.047 [debug] State: idle => busy (comm_open)
2025-05-21 22:23:50.047 [debug] <<< RECV status [iopub]: {"execution_state":"busy"}
2025-05-21 22:23:50.065 [debug] <<< RECV [kernel]: {"kind":"kernel","status":{"status":"idle","reason":"comm_open"}}
2025-05-21 22:23:50.066 [debug] State: busy => idle (comm_open)
2025-05-21 22:23:50.067 [debug] <<< RECV status [iopub]: {"execution_state":"idle"}
I'm running into the exact same issue. Every R session restarts triggers the "connection to server got closed" popup. Here are my Positron infos in case it helps:
Positron Version: 2025.05.0 build 103 Code - OSS Version: 1.99.0 Commit: 6ea5bf42fff8529b04a6b1b9e8b0c2a7d622d54c Date: 2025-04-28T03:36:51.004Z Electron: 34.3.2 Chromium: 132.0.6834.210 Node.js: 20.18.3 V8: 13.2.152.41-electron.0 OS: Linux x64 6.8.0-59-generic
The toast notification means that our error handler hasn't been set / taken into account: https://github.com/posit-dev/positron/blob/80a20f31f6deed8e071472e3f5bae800870522af/extensions/positron-r/src/lsp.ts#L119
Interesting that this only seems to happen on Linux...