coder / code-server

VS Code in the browser
https://coder.com
MIT License
68.49k stars 5.61k forks source link

Cannot reconnect. Please reload the window. #1884

Closed EwaFengler closed 4 years ago

EwaFengler commented 4 years ago

When I build release package following the steps from CONTRIBUTING.md and try to run release-standalone/code-server I have the same situation as here: https://github.com/cdr/code-server/issues/1227 - the server runs and I can access it from the browser, but basically I cannot do anything because after a second or two I get "Cannot reconnect. Please reload the window." error.

Browser console:

  ERR Error: "Connection error: Unrecognized reconnection token"
    k remoteAgentConnection.ts:553
    a remoteAgentConnection.ts:189
    fire event.ts:587
    fire ipc.net.ts:453
    _receiveMessage ipc.net.ts:736
    beginAcceptReconnection ipc.net.ts:688
    fire event.ts:587
    acceptChunk ipc.net.ts:239
    g ipc.net.ts:200
    onData browserSocketFactory.ts:178
    fire event.ts:587
    onload browserSocketFactory.ts:62
log.ts:197:11
  ERR [remote-connection][ExtensionHost][175b7\u2026][reconnect] A permanent error occurred in the reconnecting loop! Will give up now! Error: log.ts:197:11
  ERR Error: "Connection error: Unrecognized reconnection token"
    k remoteAgentConnection.ts:553
    a remoteAgentConnection.ts:189
    fire event.ts:587
    fire ipc.net.ts:453
    _receiveMessage ipc.net.ts:736
    beginAcceptReconnection ipc.net.ts:688
    fire event.ts:587
    acceptChunk ipc.net.ts:239
    g ipc.net.ts:200
    onData browserSocketFactory.ts:178
    fire event.ts:587
    onload browserSocketFactory.ts:62
log.ts:197:11
Extension host terminated unexpectedly. Code:  0  Signal:  null abstractExtensionService.ts:166:10
    _onExtensionHostCrashed abstractExtensionService.ts:166
    _onExtensionHostCrashOrExit abstractExtensionService.ts:158
    _startExtensionHosts abstractExtensionService.ts:148
    fire event.ts:587
    _onExtHostConnectionLost remoteExtensionHost.ts:201
    start remoteExtensionHost.ts:134
    fire event.ts:587
    fire ipc.net.ts:453
    acceptDisconnect ipc.net.ts:708
    x remoteAgentConnection.ts:542
    _gotoPermanentFailure remoteAgentConnection.ts:481
    triggerPermanentFailure remoteAgentConnection.ts:356
    triggerPermanentFailure remoteAgentConnection.ts:356
    _runReconnectingLoop remoteAgentConnection.ts:444
The connection to ws://localhost:8080/?type=Management&reconnectionToken=6bd470be-6961-47e5-bb82-32c20b86d20f&reconnection=false&skipWebSocketFrames=false was interrupted while the page was loading. browserSocketFactory.ts:162:30
Error received from starting extension host extensionHostManager.ts:72:12
    _proxy extensionHostManager.ts:72
timeout extensionHostManager.ts:73:12
    _proxy extensionHostManager.ts:73
code-asher commented 4 years ago

Could you post the output from code-server? Usually this is because VS Code is crashing and the output should explain why.

code-asher commented 4 years ago

Sometimes I think this can happen if using a reverse proxy that isn't set up to handle websockets as well.

EwaFengler commented 4 years ago
***** This script will soon be removed!
***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0
info  Using config file ~/.config/code-server/config.yaml
debug parsed command line {"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"8f296ab4f862ff3288f0c96d"}}
debug spawned inner process 26157
debug parsed command line {"args":{"_":[],"log":"debug"}}
debug parsed command line {"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"8f296ab4f862ff3288f0c96d"}}
debug wrapper 26132 received message from 26157 {"message":{"type":"handshake"}}
debug inner process 26157 received message from 26132 {"message":{"type":"handshake"}}
info  Using user-data-dir ~/.local/share/code-server
info  code-server 3.4.1 fb9ebeb7aa6a6b88f8711860a8416a2230dd1531
info  HTTP server listening on http://127.0.0.1:8080
info      - Using password from ~/.config/code-server/config.yaml
info      - To disable use `--auth none`
info    - Not serving HTTPS
debug forking vs code...
debug got message from vs code {"message":{"type":"ready"}}
debug setting up vs code...
debug vscode got message from code-server {"message":{"type":"init","id":"noz3r0ppnIwdKEHZeQFq2EY3","options":{"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","password":"8f296ab4f862ff3288f0c96d","log":"debug","verbose":false,"config":"/home/efengler/.config/code-server/config.yaml","user-data-dir":"/home/efengler/.local/share/code-server","extensions-dir":"/home/efengler/.local/share/code-server/extensions"},"remoteAuthority":"localhost:8080"}}}
debug got message from vs code {"message":{"type":"options","id":"noz3r0ppnIwdKEHZeQFq2EY3","options":{"workbenchWebConfiguration":{"remoteAuthority":"localhost:8080","logLevel":1,"workspaceProvider":{"payload":[["userDataPath","/home/efengler/.local/share/code-server"]]}},"remoteUserDataUri":{"$mid":1,"path":"/home/efengler/.local/share/code-server","scheme":"vscode-remote","authority":"localhost:8080"},"productConfiguration":{"nameShort":"Code - OSS","nameLong":"Code - OSS","applicationName":"code-oss","dataFolderName":".vscode-oss","win32MutexName":"vscodeoss","licenseName":"MIT","licenseUrl":"https://github.com/Microsoft/vscode/blob/master/LICENSE.txt","win32DirName":"Microsoft Code OSS","win32NameVersion":"Microsoft Code OSS","win32RegValueName":"CodeOSS","win32AppId":"{{E34003BB-9E10-4501-8C11-BE3FAA83F23F}","win32x64AppId":"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}","win32arm64AppId":"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}","win32UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32x64UserAppId":"{{C6065F05-9603-4FC4-8101-B9781A25D88E}","win32arm64UserAppId":"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}","win32AppUserModelId":"Microsoft.CodeOSS","win32ShellNameShort":"C&ode - OSS","darwinBundleIdentifier":"com.visualstudio.code.oss","linuxIconName":"com.visualstudio.code.oss","licenseFileName":"LICENSE.txt","reportIssueUrl":"https://github.com/cdr/code-server/issues/new","urlProtocol":"code-oss","extensionAllowedProposedApi":["ms-vscode.vscode-js-profile-flame","ms-vscode.vscode-js-profile-table","ms-vscode.references-view"],"builtInExtensions":[{"name":"ms-vscode.node-debug","version":"1.44.7","repo":"https://github.com/Microsoft/vscode-node-debug","metadata":{"id":"b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.node-debug2","version":"1.42.5","repo":"https://github.com/Microsoft/vscode-node-debug2","metadata":{"id":"36d19e17-7569-4841-a001-947eb18602b2","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.references-view","version":"0.0.60","repo":"https://github.com/Microsoft/vscode-reference-view","metadata":{"id":"dc489f46-520d-4556-ae85-1f9eab3c412d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug-companion","version":"1.0.2","repo":"https://github.com/microsoft/vscode-js-debug-companion","metadata":{"id":"99cb0b7f-7354-4278-b8da-6cc79972169d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.js-debug","version":"1.47.3","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"25629058-ddac-4e17-abba-74678e126c5d","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}},{"name":"ms-vscode.vscode-js-profile-table","version":"0.0.6","repo":"https://github.com/Microsoft/vscode-js-debug","metadata":{"id":"7e52b41b-71ad-457b-ab7e-0620f1fc4feb","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}}],"commit":"fb9ebeb7aa6a6b88f8711860a8416a2230dd1531","date":"2020-07-16T08:47:20Z","version":"1.47.0","extensionsGallery":{"serviceUrl":"https://extensions.coder.com/api","itemUrl":"","controlUrl":"","recommendationsUrl":""}},"nlsConfiguration":{"locale":"en","availableLanguages":{}},"commit":"fb9ebeb7aa6a6b88f8711860a8416a2230dd1531"}}}
debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"Management","reconnectionToken":"06cc94bd-787b-4ba8-a4d8-a7b8743a35a3","reconnection":"false","skipWebSocketFrames":"false"}}}
debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"ExtensionHost","reconnectionToken":"49c6e0f1-e560-4590-b6b6-cf4a8313201c","reconnection":"false","skipWebSocketFrames":"false"}}}
debug vscode got message from code-server {"message":{"type":"socket","query":{"type":"ExtensionHost","reconnectionToken":"49c6e0f1-e560-4590-b6b6-cf4a8313201c","reconnection":"true","skipWebSocketFrames":"false"}}}
DAddYE commented 4 years ago

Is happening to me too, I'm on Catalina and latest code-server master/raw. Compiled successfully, and except some issue where if fsevents was less than 1.1.13 It would fail ... but still complete the build (seems common with node > 11 and fsevents < 1.1.13).

I don't see errors in my server' logs, and the client (ui) is saying that the WebSocke the token is invalid...

code-asher commented 4 years ago

Interesting, it looks like only the extension host is crashing then.

Is there anything in the VS Code logs? Should be in ~/.local/share/code-server/logs/[date].

Are y'all building and running on the same machine or building on one machine and then running on another? Could be some kind of libc issue.

DAddYE commented 4 years ago

Hi, this the output on a fresh raw/mainstream:

➜ tail -fn 10000 ~/.local/share/code-server/logs/20200720T185022/remoteagent.log
[2020-07-20 18:50:25.184] [remoteagent] [error] /Users/daddye/.local/share/code-server/extensions {"errno":-2,"code":"ENOENT","syscall":"scandir","path":"/Users/daddye/.local/share/code-server/extensions"}
[2020-07-20 18:50:52.426] [remoteagent] [error] [File Watcher (node.js)] Error: ENOENT: no such file or directory, stat '/Users/daddye/.local/share/code-server/User/snippets'
[2020-07-20 18:50:52.426] [remoteagent] [error] [File Watcher (node.js)] Error: ENOENT: no such file or directory, stat '/Users/daddye/.local/share/code-server/User/snippets'
[2020-07-20 18:50:53.979] [remoteagent] [error] Extension host stderr internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module './bootstrap-node'
Require stack:
- /Users/daddye/code-server/release-standalone/lib/vscode/out/bootstrap-fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/daddye/code-server/release-standalone/lib/vscode/out/bootstrap-fork.js:5:67)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/daddye/code-server/release-standalone/lib/vscode/out/bootstrap-fork.js'
  ]
}
EwaFengler commented 4 years ago

I'm building and running on the same machine

code-asher commented 4 years ago

Ahhh found the issue, thank you both for reporting and debugging. Will have a fix soon.

code-asher commented 4 years ago

I pushed a fix, please let me know if it works. Thanks again!

DAddYE commented 4 years ago

I pushed a fix, please let me know if it works. Thanks again!

I confirm that it fixed the issue! Thank you!

ericbuess commented 4 years ago

@code-asher I built code-server with yarn per the guide and I was running into this recurring “Cannot connect. Please reload the window” error message. It seems to be working now though so nothing to report. I lost the logs (so I don’t know if it was the same cause) because I have it running in a docker container that I’ve rebuilt a few times since seeing the error. I’ll post logs if I see the issue again.

I have this running on a Raspberry Pi 4b in a docker container with https running on top of the Ubuntu Eoan image. It took a while to figure out the right OS that would be compatible with everything but it’s working great now.

I only wish the Microsoft’s Remote Containers extension was allowed and that scrolling would work from the Magic Keyboard’s trackpad on the iPad Pro.

Thanks for the great work!