coder / code-server

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

Endless Loading #2585

Closed kaaax0815 closed 3 years ago

kaaax0815 commented 3 years ago

Startup Log:

$ code-server --verbose
[2021-01-14T18:47:53.237Z] trace child:1165 got message {"message":{"type":"handshake","args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","hashed-password":"5844b494fa2dfc78d2f9157b29dd1f26215e64024caf59f05222fb1b4bb6e852","config":"/home/bernd/.config/code-server/config.yaml","verbose":true,"user-data-dir":"/home/bernd/.local/share/code-server","extensions-dir":"/home/bernd/.local/share/code-server/extensions","log":"trace","host":"127.0.0.1","port":8080,"proxy-domain":[],"usingEnvPassword":false,"usingEnvHashedPassword":false}}}
[2021-01-14T18:47:53.239Z] info  code-server 3.8.0 c4610f7829701aadb045d450013b84491c30580d
[2021-01-14T18:47:53.239Z] info  Using user-data-dir ~/.local/share/code-server
[2021-01-14T18:47:53.239Z] trace Using extensions-dir ~/.local/share/code-server/extensions
[2021-01-14T18:47:53.355Z] info  Using config file ~/.config/code-server/config.yaml
[2021-01-14T18:47:53.355Z] info  HTTP server listening on http://127.0.0.1:8080
[2021-01-14T18:47:53.355Z] info    - Authentication is enabled
[2021-01-14T18:47:53.355Z] info      - Using password from ~/.config/code-server/config.yaml
[2021-01-14T18:47:53.355Z] info    - Not serving HTTPS

Log when loading website:

trace heartbeat
[2021-01-14T18:48:47.521Z] debug forking vs code...
[2021-01-14T18:48:49.521Z] trace got message {"message":{"type":"ready"}}
[2021-01-14T18:48:49.521Z] debug setting up vs code...
[2021-01-14T18:48:49.524Z] debug vscode got message from code-server {"type":"init"}
[2021-01-14T18:48:49.606Z] trace vscode code-server message content {"message":{"type":"init","id":"ERZf8dWuFqWurS7af5ziBJSZ","options":{"args":{"_":[],"bind-addr":"127.0.0.1:8080","auth":"password","hashed-password":"5844b494fa2dfc78d2f9157b29dd1f26215e64024caf59f05222fb1b4bb6e852","config":"/home/bernd/.config/code-server/config.yaml","verbose":true,"user-data-dir":"/home/bernd/.local/share/code-server","extensions-dir":"/home/bernd/.local/share/code-server/extensions","log":"trace","host":"127.0.0.1","port":8080,"proxy-domain":[],"usingEnvPassword":false,"usingEnvHashedPassword":false},"remoteAuthority":"code.kaaaxcreators.de","startPath":{"url":"/home/bernd/Workplace","workspace":false}}}}
[server] storing proxy {"proxyId":"child_process"}
[server] storing proxy {"proxyId":"fs"}
[server] storing proxy {"proxyId":"net"}
[2021-01-14T18:48:49.799Z] trace got message {"message":{"type":"options","id":"ERZf8dWuFqWurS7af5ziBJSZ","options":{"workbenchWebConfiguration":{"folderUri":{"$mid":1,"path":"/home/bernd/Workplace","scheme":"vscode-remote","authority":"code.kaaaxcreators.de"},"remoteAuthority":"code.kaaaxcreators.de","logLevel":0,"workspaceProvider":{"payload":[["userDataPath","/home/bernd/.local/share/code-server"],["enableProposedApi","[]"]]},"homeIndicator":{"href":"https://github.com/cdr/code-server","icon":"code","title":"Home"}},"remoteUserDataUri":{"$mid":1,"path":"/home/bernd/.local/share/code-server","scheme":"vscode-remote","authority":"code.kaaaxcreators.de"},"productConfiguration":{"nameShort":"code-server","nameLong":"code-server","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":"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}","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","ms-vscode.github-browser"],"builtInExtensions":[{"name":"ms-vscode.node-debug","version":"1.44.14","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.71","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.8","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.51.0","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.11","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"}}],"webBuiltInExtensions":[{"name":"ms-vscode.github-browser","version":"0.0.13","repo":"https://github.com/microsoft/vscode-github-browser","metadata":{"id":"c1bcff4b-4ecb-466e-b8f6-b02788b5fb5a","publisherId":{"publisherId":"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee","publisherName":"ms-vscode","displayName":"Microsoft","flags":"verified"},"publisherDisplayName":"Microsoft"}}],"//":"https://github.com/VSCodium/vscodium/pull/155/files","documentationUrl":"https://go.microsoft.com/fwlink/?LinkID=533484#vscode","keyboardShortcutsUrlMac":"https://go.microsoft.com/fwlink/?linkid=832143","keyboardShortcutsUrlLinux":"https://go.microsoft.com/fwlink/?linkid=832144","keyboardShortcutsUrlWin":"https://go.microsoft.com/fwlink/?linkid=832145","introductoryVideosUrl":"https://go.microsoft.com/fwlink/?linkid=832146","tipsAndTricksUrl":"https://go.microsoft.com/fwlink/?linkid=852118","newsletterSignupUrl":"https://www.research.net/r/vsc-newsletter","commit":"c4610f7829701aadb045d450013b84491c30580d","date":"2020-12-18T20:25:37Z","version":"1.51.1","extensionsGallery":{"serviceUrl":"https://extensions.coder.com/api","itemUrl":"","controlUrl":"","recommendationsUrl":""}},"nlsConfiguration":{"locale":"en","availableLanguages":{}},"commit":"c4610f7829701aadb045d450013b84491c30580d"}}}

When using the --link Parameters, it works fine.

Caddy Startup Log:

Jan 14 19:53:14 srv18447 caddy[1267]: JOURNAL_STREAM=9:3358074469
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.0770981,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.0783339,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin>
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.079111,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection pol>
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.0791283,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.0794227,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["code.kaaaxcr>
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.0851908,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0>
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.124506,"logger":"tls","msg":"cleaned up storage units"}
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.1357727,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Jan 14 19:53:14 srv18447 caddy[1267]: {"level":"info","ts":1610650394.135796,"msg":"serving initial configuration"}

Browser Log (Error):

INFO [remote-connection][Management   ][d8915…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] waiting for 5 seconds before reconnecting...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] resolving connection...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] connecting to code.kaaaxcreators.de:80...
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/dist/pages/pages/vscode.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] reconnected!
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] waiting for 5 seconds before reconnecting...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] resolving connection...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] connecting to code.kaaaxcreators.de:80...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][d8915…][reconnect] reconnected!
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js.map: Load canceled due to load timeout
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/node_modules/xterm/lib/xterm.js.map: Load canceled due to load timeout
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/out/vs/base/worker/workerMain.js.map: Load canceled due to load timeout
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/out/vs/workbench/contrib/output/common/outputLinkComputer.js.map: Load canceled due to load timeout
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/out/vs/loader.js.map: Load canceled due to load timeout
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/out/vs/workbench/services/extensions/worker/extensionHostWorker.js.map: Load canceled due to load timeout
DevTools failed to load SourceMap: Could not load content for https://code.kaaaxcreators.de/static/c4610f7829701aadb045d450013b84491c30580d/usr/lib/code-server/lib/vscode/out/vs/workbench/services/extensions/worker/extensionHostWorker.nls.js.map: Load canceled due to load timeout
workbench.web.api.js:4633 Error received from starting extension host
(anonymous) @ workbench.web.api.js:4633
workbench.web.api.js:4633 timeout
(anonymous) @ workbench.web.api.js:4633

Addition: I have Cloudcmd Running using Caddy Reverse Proxy It works sometimes, sometimes not I cant ping, or curl github, so I installed it manually using the deb-Package Specs: 1 Gb Ram 7gb Remaining Storage Intel(R) Xeon(R) CPU E3-1270 V2 @ 3.50GHz Cpu Usage about 25%

No waiting 30mins, it loaded the Ui but stillt doesnt load files. I dont have Internet neither the server

kaaax0815 commented 3 years ago

I figured out, when entering the Site and waiting like 10mins it works. I immediately went on a file, and this was i think bad. using --link fixed like every problem, extensions load fast, the code shows instantly, syntax highlight works after only a second. Maybe its a problem with caddy. I think I am removing caddy and trying nginx (doesnt work well https://github.com/cdr/code-server/discussions/2593). The thing is, because caddy works with another service just fine, I'll use caddy as redirect to the --link

nhooyr commented 3 years ago

I figured out, when entering the Site and waiting like 10mins it works.

Something seems very wrong here but I'm not sure. Have you followed our setup guide linked in the README that explains how to setup caddy or nginx?

kaaax0815 commented 3 years ago

I exactly followed the guide, but as i mentioned i have a weird dns, i think our proxy does some thing. With nginx I get 502 mentioned in #2593

kaaax0815 commented 3 years ago

I used many other Hoster now and everywhere its works just fine, its either the only 1 core and 1gb ram or the missing IPv4 support. The nice thing is, that --link makes it work just fine

wiserain commented 3 years ago

I discovered this issue repeating following logs

TRACE Started scanning user extensions
TRACE [Error: ENOENT: no such file or directory, open '/usr/lib/code-server/lib/vscode/extensions/node_modules/package.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/usr/lib/code-server/lib/vscode/extensions/node_modules/package.json'
}
TRACE [Error: ENOTDIR: not a directory, scandir '/usr/lib/code-server/lib/vscode/extensions/package.json'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: '/usr/lib/code-server/lib/vscode/extensions/package.json'
}
TRACE [Error: ENOTDIR: not a directory, scandir '/usr/lib/code-server/lib/vscode/extensions/postinstall.js'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: '/usr/lib/code-server/lib/vscode/extensions/postinstall.js'
}
TRACE Scanned user extensions: 28
TRACE [Error: ENOTDIR: not a directory, scandir '/usr/lib/code-server/lib/vscode/extensions/yarn.lock'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: '/usr/lib/code-server/lib/vscode/extensions/yarn.lock'
}
TRACE Scanned system extensions: 85
TRACE [File Watcher (node.js)] [CHANGED] /home/username/.local/share/code-server/User/state/global.json
TRACE [File Watcher (node.js)] [CHANGED] /home/username/.local/share/code-server/User/state/global.json
TRACE [File Watcher (node.js)] >> normalized [CHANGED] /home/username/.local/share/code-server/User/state/global.json
TRACE [File Watcher (node.js)] [CHANGED] /home/username/.local/share/code-server/User/state/global.json
TRACE [File Watcher (node.js)] >> normalized [CHANGED] /home/username/.local/share/code-server/User/state/global.json
TRACE Started scanning user extensions
TRACE Scanned user extensions: 28
[2021-03-27T07:33:23.998Z] debug vscode got message from code-server {"type":"socket"}
[2021-03-27T07:33:23.998Z] trace vscode code-server message content {"message":{"type":"socket","query":{"reconnectionToken":"REDACTED-TOKEN","reconnection":"true","skipWebSocketFrames":"false"},"permessageDeflate":true}}
[2021-03-27T07:33:24.001Z] trace vscode Protocol handshake {"token":"REDACTED-TOKEN"}
[2021-03-27T07:33:24.003Z] trace vscode Protocol message {"token":"REDACTED-TOKEN","message":"{\"type\":\"auth\",\"auth\":\"00000000000000000000\"}"}
[2021-03-27T07:33:24.009Z] trace vscode Protocol message {"token":"REDACTED-TOKEN","message":"{\"type\":\"connectionType\",\"commit\":\"109d2ce3247869eaeab67aa7e5423503ec9eb859\",\"signedData\":\"\",\"desiredConnectionType\":2,\"args\":{\"language\":\"en\",\"break\":false,\"port\":null}}"}
[2021-03-27T07:33:24.010Z] trace exthost Sending socket {"token":"REDACTED-TOKEN"}
[2021-03-27T07:33:24.012Z] warn  vscode Socket is closed
[2021-03-27T07:33:38.269Z] trace 2 active connections
[2021-03-27T07:33:38.270Z] trace heartbeat
[2021-03-27T07:33:44.051Z] debug vscode got message from code-server {"type":"socket"}
[2021-03-27T07:33:44.052Z] trace vscode code-server message content {"message":{"type":"socket","query":{"reconnectionToken":"REDACTED-TOKEN","reconnection":"true","skipWebSocketFrames":"false"},"permessageDeflate":true}}
[2021-03-27T07:33:44.052Z] trace vscode Protocol handshake {"token":"REDACTED-TOKEN"}
[2021-03-27T07:33:44.055Z] trace vscode Protocol message {"token":"REDACTED-TOKEN","message":"{\"type\":\"auth\",\"auth\":\"00000000000000000000\"}"}
[2021-03-27T07:33:44.057Z] trace vscode Protocol message {"token":"REDACTED-TOKEN","message":"{\"type\":\"connectionType\",\"commit\":\"109d2ce3247869eaeab67aa7e5423503ec9eb859\",\"signedData\":\"\",\"desiredConnectionType\":2,\"args\":{\"language\":\"en\",\"break\":false,\"port\":null}}"}
[2021-03-27T07:33:44.058Z] trace exthost Sending socket {"token":"REDACTED-TOKEN"}

It seems losing/denying socket connection and retrying, which results in improperly working extensions (for example cannot track git difference) and some other things.

Interestingly it is okay with HTTP direct connection. So the problem is with HTTPS reverse proxy (traefik in my case). However, there's no luck for any workarounds. I will try it with other reverse proxies like nginx.

wiserain commented 3 years ago

The issue described above is nothing to do with reverse proxy solution. It is sorted out by re-installation using npm from scratch. In my guess, something is broken with pre-built deb package for ubuntu.