code-server: Cannot automatically reconnect when code-server restarts
- Web Browser: Microsoft Edge/Chrome
- Local OS: MacOS BigSur 11.
- Remote OS: Ubuntu Linux (Linux dev-box 5.4.0-1037-oracle #40-Ubuntu SMP Thu Jan 14 09:19:02 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux)
- Remote Architecture: amd64
code-server --version: 3.8.1 41ad0c0c4c14df78e1bfa3a44d8b633ed2fc26e5
The service by itself starts up fine. Later on when I try to connect to the remote server I keep seeing this error over and over again in the systemd logs.
ubuntu@dev-box:~$ journalctl -u code-server@ubuntu | tail
Feb 08 22:14:58 dev-box code-server[2710]: at Object.next (/usr/lib/code-server/out/node/vscode.js:44:53)
Feb 08 22:14:58 dev-box code-server[2710]: at fulfilled (/usr/lib/code-server/out/node/vscode.js:35:58)
Feb 08 22:14:58 dev-box code-server[2710]: at processTicksAndRejections (internal/process/task_queues.js:97:5)
Feb 08 22:15:08 dev-box code-server[2710]: [2021-02-08T16:45:08.475Z] error vscode is not running Error: vscode is not running
Feb 08 22:15:08 dev-box code-server[2710]: at VscodeProvider.send (/usr/lib/code-server/out/node/vscode.js:206:19)
Feb 08 22:15:08 dev-box code-server[2710]: at VscodeProvider.<anonymous> (/usr/lib/code-server/out/node/vscode.js:198:30)
Feb 08 22:15:08 dev-box code-server[2710]: at step (/usr/lib/code-server/out/node/vscode.js:63:23)
Feb 08 22:15:08 dev-box code-server[2710]: at Object.next (/usr/lib/code-server/out/node/vscode.js:44:53)
Feb 08 22:15:08 dev-box code-server[2710]: at fulfilled (/usr/lib/code-server/out/node/vscode.js:35:58)
Feb 08 22:15:08 dev-box code-server[2710]: at processTicksAndRejections (internal/process/task_queues.js:97:5)
Let me know if you need any other logs/information, I’ll be happy to provide them for you.
Updated Workaround: Essentially if code-server crashes and recovers you’ll have to close your code-server browser window and restart it again in the background.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (8 by maintainers)
@jsjoeio, as @walterreade rightly pointed out, this issue is seen intermittently only when you restart
code-serverwhen an active connection is in place. There are no extra logs being displayed even when you’re in debug mode. My suspicion is that this could also be a long standing issue and not a regression (won’t know until we try).Here’s how you can reproduce this (not consistently, but not super rare either):
and you’ll see this error and code-server won’t recover till you kill it.
WORKAROUND: Essentially if code-server crashes and recovers you’ll have to close your code-server browser window and restart it again in the background.
It’s intermittent for me, and I can’t isolate when/why it happens.
remoteagent.log
[2021-02-10 22:31:26.624] [remoteagent] [error] /home/inversion/.local/share/code-server/extensions {"errno":-2,"code":"ENOENT","syscall":"scandir","path":"/home/inversion/.local/share/code-server/extensions"}exthost.log
I appreciate everyone’s work here! 😃
I’m unable to reproduce this on a fresh install. Will be able to install 3.8.1 only over the weekend (I use code-server as my primary daily driver).
Here’s how I tried to reproduce it in an isolated environment (although, I failed to reproduce it):
Trying to connect on localhost:8080 is working fine for now.
Sorry, I have unsubscribed from this issue. I have updated the workaround in the first comment so that folks coming from searches get to know of it without scrolling to the bottom.
Also, yes @code-asher even I had suspected that same. Downgrading probably helped me by not crashing my code-server in the first place.
But I’m not sure if this is the same problem initially reported? Because 3.8.0 has the same behavior and downgrading is mentioned to work.
Ohhh yeah VS Code is spawned when the page initially connects. Reconnection won’t spawn it again so a page refresh is required if the process restarts during an active connection.
It might make sense for us to spawn it on a reconnection anyway. The reconnection will then fail because there’s no longer any reconnection state on the server end but I think at that point at least VS Code will ask you to refresh rather than keep trying to reconnect.
@jsjoeio This was a fresh install on a new VM, with no extensions added. (And again the issue disappeared by downgrading to
3.8.0.@zapstar When running the Container as root that should not happen. I fixed this issue by using
USER rootin the Dockerfile. But I dont use Code-server on docker. I use caprover reverse proxy to code-server on host@kaaax0815 that could be the case as well, I was running the container as root.
I got this error in Docker when having Bad File Permissions
Ran into the same issue. Also resolved by downgrading to
3.8.0.Can I enable debug or something like that could help you further. Looks like accessing vscode via browser is killing some process. If you can see it complains about
error vscode is not running Error: vscode is not running.