code-server: Cannot reconnect. Please reload the window.

OS/Web Information

  • Web Browser: Google Chrome 97.0.4692.71
  • Local OS: windows 11
  • Remote OS: centos 8
  • Remote Architecture: amd64
  • code-server --version: 4.0.1

same of #1884

 INFO [Service Worker] registered
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] resolving connection...
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] connecting to 10.1.1.182:443...
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] reconnected!
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] resolving connection...
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] connecting to 10.1.1.182:443...
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] reconnected!
log.ts:313   ERR Error received from starting extension host (kind: Remote)
log.ts:313   ERR The remote extenion host took longer than 60s to send its ready message.
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] resolving connection...
log.ts:301  INFO [remote-connection][ExtensionHost][1a408…][reconnect] connecting to 10.1.1.182:443...
log.ts:313   ERR [remote-connection][ExtensionHost][1a408…][reconnect][10.1.1.182:443] received error control message when negotiating connection. Error:
log.ts:313   ERR Error: Connection error: Unknown reconnection token (seen before)
    at W (remoteAgentConnection.ts:732:17)
    at remoteAgentConnection.ts:327:17
    at l.fire (event.ts:577:16)
    at u.fire (ipc.net.ts:511:19)
    at r._receiveMessage (ipc.net.ts:873:27)
    at ipc.net.ts:818:73
    at l.fire (event.ts:577:16)
    at d.acceptChunk (ipc.net.ts:284:21)
    at ipc.net.ts:245:51
    at browserSocketFactory.ts:197:39
log.ts:313   ERR [remote-connection][ExtensionHost][1a408…][reconnect] A permanent error occurred in the reconnecting loop! Will give up now! Error:
log.ts:313   ERR Error: Connection error: Unknown reconnection token (seen before)
    at W (remoteAgentConnection.ts:732:17)
    at remoteAgentConnection.ts:327:17
    at l.fire (event.ts:577:16)
    at u.fire (ipc.net.ts:511:19)
    at r._receiveMessage (ipc.net.ts:873:27)
    at ipc.net.ts:818:73
    at l.fire (event.ts:577:16)
    at d.acceptChunk (ipc.net.ts:284:21)
    at ipc.net.ts:245:51
    at browserSocketFactory.ts:197:39
abstractExtensionService.ts:644 Extension host (Remote) terminated unexpectedly. Code: 0, Signal: null

Steps to Reproduce

  1. edit config.yaml and add this:
bind-addr: 127.0.0.1:8080
auth: password
password: "12345"
cert: true
  1. run code-server: code-server

Expected

code-server can be accessed via HTTPS and all expected features work.

Actual

Browser complains about about SSL certificate says “Cannot reconnect”

Screenshot

image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 17
  • Comments: 30 (8 by maintainers)

Most upvoted comments

I was able to downgrade my Ubuntu install which is working fine now.

> curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 3.12.0
Ubuntu 20.04.3 LTS
Installing v3.12.0 of the amd64 deb package from GitHub.

How do I downgrade my macOS install? Even though I pass the version, it tries to install the latest.

> curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 3.12.0
macOS v11.6.2
Installing latest from Homebrew.

I have the same situation. Additionally it seems like some extensions can’t load their settings and don’t work.

Additionally, reverting to 3.12.0, I do not exhibit the above behavior.

I can confirm, 3.12.0 does not exhibit the same behavior. No errors after downgrading.

It happens to me too.

Still have the same issue with the newly released v4.0.2.

If I recall correctly there were some siginficant removals around code designed to handle the cert case so it is possible this is another case of code removed that should not have been.

Looking forward to it being fixed

code-server: v4.0.2 VS Code: v1.63.0 Commit: 5cdfe74686aa73e023f8354a9a6014eb30caa7dd Date: 2022-01-27T22:22:39Z Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43

Upgraded from 3.11 and now getting the “Cannot reconnect. Please reload window.” so often, it’s unusable. Going to try a downgrade.

Re-reading comments, I am using --cert option. [Service] Type=exec ExecStart=/usr/bin/code-server --cert /home/foo/ssl/some.crt --cert-key /home/foo/ssl/some.key --bind-addr 0.0.0.0:8080 Restart=always User=%i

Running on an ubuntu box, with deb install and upgrades since 3.9. Reverted to 3.12, no issues.

Just to clarify…this is making code-server unusable for everyone right?

Is there a certain browser it does work with? I work off of my macOS Chrome and my iPad (Safari) and getting this issue in both places.

Stick with 3.12.0 until they release 4.0.3 where a patch for this issue is slated

This can be replicated & tested on any system (tested on macOS, Windows, and Linux) with the docker command below.

Log in with https on port 8080 with the password “temp” and bypass the untrusted cert warning. Just sit back and watch the Console logs and after about 2 minutes you will get the connection error. Even when I pass a valid trusted cert, I still get the reconnection errors.

If I remove the --cert flag and log in with http, I do not get any reconnection errors.

docker run --rm --name code-server --entrypoint "/usr/bin/entrypoint.sh" -p 0.0.0.0:8080:8080 -e PASSWORD="temp" codercom/code-server:4.0.1 --bind-addr 0.0.0.0:8080 --auth "password" --cert

For me, this behavior occurs on a fresh install when specifying a cert in config.yaml. Extensions successfully load with cert: false and I no longer get the “Cannot reconnect. Please reload the window.” popup.

(edit: my environment) Pop!_OS 21.10 x86_64 Firefox 96.0b10

Just to clarify…this is making code-server unusable for everyone right?

Is there a certain browser it does work with? I work off of my macOS Chrome and my iPad (Safari) and getting this issue in both places.

for me a fresh 4.0.2 (SSL) installation is not working with “$HOME/.config/code-server/config.yaml” file:

bind-addr: <server_ip>:443
auth: none
cert: true

in any browser in Windows and MacOS. But more strange is that a fresh installation of 4.0.1 “curl -fsSL https://code-server.dev/install.sh | sh -s – --version=4.0.1” also is not working now too when it was before 4.0.2 was released.

As a workaround, I disabled SSL in 4.0.2 to use nginx as front-end with “$HOME/.config/code-server/config.yaml” file:

bind-addr: 127.0.0.1:8080
auth: password
password: <my_password>
cert: false

and it’s working.

Even with the extensions activated, I try to open the list of accounts and it keeps loading, until several seconds pass and the same error appears. I think the problem is there.

Can confirm same behavior using the codercom/code-server:4.0.1 docker image on docker. codercom/code-server:3.12.0 works as intended.

vincent@3:~/code/.config/code-server$ cat config.yaml 
bind-addr: 127.0.0.1:5443
auth: password
password: redacted
cert: true
proxy-domain: code.quickbrownfoxes.org

Counter point, I have never touched the config.yml file when experiencing this issue. I went and checked mine to be sure and it is, I presume, default:

bind-addr: 127.0.0.1:8080
auth: password
password: <redacted>
cert: false