Repository navigation
Cannot reconnect. Please reload the window. #4693
Copy link
Copy link
Closed
Labels
high-priorityThis issue needs to be resolved ASAPThis issue needs to be resolved ASAP
Milestone
Description
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
- edit
config.yamland add this:
bind-addr: 127.0.0.1:8080
auth: password
password: "12345"
cert: true- 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
high-priorityThis issue needs to be resolved ASAPThis issue needs to be resolved ASAP

Activity
sobakaio commentedon Jan 6, 2022
I have the same situation.
Additionally it seems like some extensions can't load their settings and don't work.
tenpaiyomi commentedon Jan 6, 2022
Receiving the same issue here as well, completely fresh install. I've noticed a few things, similar to the above, which makes me believe this is the extension host again.
1, the reconnecting loop happens exactly 3 times.
2, Between the 2nd and 3rd reconnect loop, I'm getting the following error message in the console logs
3, After the 2nd reconnect, before the 3rd, I get the following errors:
tenpaiyomi commentedon Jan 6, 2022
Additionally, reverting to 3.12.0, I do not exhibit the above behavior.
aleleba commentedon Jan 6, 2022
It happens to me too.
jsjoeio commentedon Jan 7, 2022
Can someone please provide reproduction steps? I'm running 4.0.1 on macOS with Brave and do not see this.
tenpaiyomi commentedon Jan 7, 2022
@jsjoeio for me it was just installing the image, starting it up and loading up the UI. Latest Firefox, Win 10.
jsjoeio commentedon Jan 7, 2022
I'm running from source directly on macOS + Brave and can't reproduce this :(
@code-asher any ideas?
onepunchdan commentedon Jan 7, 2022
For me, this behavior occurs on a fresh install when specifying a cert in config.yaml. Extensions successfully load with
cert: falseand I no longer get the "Cannot reconnect. Please reload the window." popup.(edit: my environment)
Pop!_OS 21.10 x86_64
Firefox 96.0b10
JtMotoX commentedon Jan 8, 2022
@onepunchdan good catch!
I upgraded to 4.0.1 and now none of my extensions loaded and after about 5 seconds I receive the error and same console logs that the OP mentioned.
I commented out my cert configs in my config.yaml and reloaded and now it loads fine with all my extensions and no errors (except for the untrusted connection error).
@jsjoeio maybe this will be enough info for you to replicate the issue?
tenpaiyomi commentedon Jan 8, 2022
Counter point, I have never touched the
config.ymlfile when experiencing this issue. I went and checked mine to be sure and it is, I presume, default:ochen1 commentedon Jan 8, 2022
I can confirm,
3.12.0does not exhibit the same behavior. No errors after downgrading.JtMotoX commentedon Jan 8, 2022
I was able to downgrade my Ubuntu install which is working fine now.
How do I downgrade my macOS install? Even though I pass the version, it tries to install the latest.
vincentchu37 commentedon Jan 8, 2022
Can confirm same behavior using the
codercom/code-server:4.0.1docker image on docker.codercom/code-server:3.12.0works as intended.JtMotoX commentedon Jan 9, 2022
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
--certflag and log in with http, I do not get any reconnection errors.10 remaining items
hecnavsanz commentedon Jan 29, 2022
Hi, I've been working during months w/ 4.0.1 ('ms-python.python', 'redhat.java' and 'kelvin.vscode-sshfs' extensions) deploying many different environments w/o any issues using "curl -fsSL https://code-server.dev/install.sh | sh" and systemctl and the following "$HOME/.config/code-server/config.yaml" file:
after upgrading to 4.0.2 I'm getting the same error "Cannot reconnect. Please reload the window." in the web browser.
I started manually Code-Server w/ "code-server --verbose" and this is the log output:
and even I'm trying to rollback now to install Code-Server w/ the old version 4.0.1 in a totally new env and I don't know why now I'm having the same problem too as of 4.0.2 when it wasn't in the past ... it's supposed that the 4.0.1 code has not been modified, isn't it?
Thanx again.
jsjoeio commentedon Jan 31, 2022
@kexirong thanks for the notes! I'm not 100% what the issue is. We'll need to take a closer look.
tomsherrod commentedon Feb 1, 2022
code-server: v4.0.2
VS Code: v1.63.0
Commit: 5cdfe74
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.
invictus2010 commentedon Feb 4, 2022
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.
vincentchu37 commentedon Feb 4, 2022
Stick with 3.12.0 until they release 4.0.3 where a patch for this issue is slated
hecnavsanz commentedon Feb 4, 2022
for me a fresh 4.0.2 (SSL) installation is not working with "$HOME/.config/code-server/config.yaml" file:
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:
and it's working.
jsjoeio commentedon Feb 8, 2022
I'm looking into this now. I was able to reproduce locally and updated the original issue with steps and a screenshot.
I need to continue investigating. I'll update this comment with my notes.
Notes
❌ The generated cert is not the issue
If you put
cert: truein yourconfig.yaml, we generate an SSL certificate for you. I usedopensslto generate a certificate and passed that tocode-server --cert <path-to-cert> --cert-key <path-to-key>and received the same results.Therefore, I do not believe the generated certificate is the root cause of this issue.
❓ What about the place where code-server tells VS Code about the cert?
TODO - investigate
Asher gave me some pointers. I'm going to see if we can take a TDD approach to show this is a bug and then fix it.
Notes from debug with Asher 2/9
It seems that VS Code is getting stuck before sending the socket to the extension host (after calling socket drain). Not sure why, we'll need to investigate tomorrow.
Workarounds
use a tool like
ngrokIt appears exposing the port with ngrok solves the problem (because ngrok has a valid SSL certificate).
i.e.
ngrok http https://localhost:8080-> gives you something like https://f2c9-65-127-76-6.ngrok.io/2/10/22
What do we know so far?
We know that
--certworked in 3.12.0 and this bug did not exist. We wrote a new e2e test that proves this used to by testing it against a 3.12.0 build (video in issue description).kkv0id commentedon Feb 14, 2022
Looking forward to it being fixed