-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
upstreamIssues due to an upstream issue in VSCode or other dependency.Issues due to an upstream issue in VSCode or other dependency.
Description
Hi Team! When using Cursor/VSCode desktop, whenever we close and reopen laptop even for a few seconds, we see a popup Cannot reconnect. Please reload the window. I was wondering if this is expected behavior and if you might be aware of some settings that would make VSCode reconnect more smoothly? I tried changing connect timeout and max reconnection attempts so far but didn't see a difference.
VSCode connection often disconnects even for a slight network issue or if the device sleeps. I am unsure if this is caused by how VSCode handles remote connections as coder ssh <workspace>
survives device sleep.
franklhs, matifali and stirby
Metadata
Metadata
Assignees
Labels
upstreamIssues due to an upstream issue in VSCode or other dependency.Issues due to an upstream issue in VSCode or other dependency.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
f0ssel commentedon Feb 10, 2025
It is possible that #420 may have solved this issue. @bcpeinhardt said he's going to try to see if he can repro and confirm if this change fixes things.
bcpeinhardt commentedon Feb 13, 2025
@bpmct curious why this is marked as blocked?
bcpeinhardt commentedon Feb 13, 2025
Leaving as
todo
in Bugs Board because it doesn't seem to have a Blocked status available.bpmct commentedon Feb 14, 2025
@matifali told me we are are unable to reproduce and waiting on a user. If we are able to repro, this feel pretty important so don't mean to arbitrarily "block" anything
8 remaining items
csibe17 commentedon May 12, 2025
I can still reproduce the issue.
If I hit cancel I can find these logs in Remote - SSH output:
I hope it helps.
ethanndickson commentedon Jun 3, 2025
This has been a known issue with VSCode for a few years: microsoft/vscode-remote-release#5755
Using something like https://eternalterminal.dev/ to preserve the TCP connection between connection changes appears to resolve the issue.
DanielleMaywood commentedon Jun 4, 2025
Adding some context from some testing:
If I unplug my ethernet cable from my MacBook, it takes consistently around 18s to popup the "Cannot reconnect. Please reload the window."
If I close the lid of my MacBook whilst not plugged in to power, and wait roughly 15s, and then open it again, it will popup with "Cannot reconnect. Please reload the window."
I end up getting either one of two errors occur:
stderr> error: Get "https://<coder deployment>": dial tcp: lookup <coder deployment>: no such host
Unknown reconnection token (never seen).
after successfully connecting to the host.sachit-menon commentedon Jun 17, 2025
@ethanndickson could you say a little more on how to use ET to prevent this situation?
ethanndickson commentedon Jun 18, 2025
We're also tracking how we at Coder can improve this experience in coder/coder#18101, including a PoC for Eternal Terminal
spikecurtis commentedon Jul 7, 2025
VS Code Server (
server-main.js
) has 2 kinds of connections:They are both websocket connections.
When we get either one, the VS Code Server sets a 5 minute reconnection timeout on all connections of both types. If you reconnect, it cancels the timeout.
It appears that macOS briefly “sleepwalks” and allows VS Code Desktop to reconnect to the workspace (12:28:38 in the above log). Sometimes it doesn’t manage to reconnect to the ExtensionHostConnection, and the 5 minute timer starts. If you don’t wake your laptop within 5 minutes, the ExtensionHostConnection is closed (12:33:40 above), and you will have to “Reload Window” when you wake. When all ExtensionHostConnections are closed, then the VS Code Server shuts down.
I believe this mechanism is the source of the
Unknown reconnection token (never seen)
errors that we see after a relatively short sleep.Even if you don’t trigger this timeout, there is a 3h “long” disconnection timeout.