-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code server disconnects after browser inactivity for a while #7016
Comments
Weird, I did not think VS Code had any kind of idle timeout mechanism. I will try to leave code-server open and see if I can reproduce, but in the meantime can you share the browser console logs? |
Hi, thanks for the quick reply c.ServerProxy.servers = {
'codeserver': {
'launcher_entry': {
'enabled': True,
'title': 'Code Server',
'icon_path': '/home/ec2-user/SageMaker/.code-server/icon.svg'
},
'command': ['/home/ec2-user/SageMaker/.code-server/bin/code-server', '--auth', 'none', '--disable-telemetry', '--bind-addr', '127.0.0.1:{port}', '--open', '/home/ec2-user/SageMaker/'],
'environment': {
'XDG_DATA_HOME': '/home/ec2-user/SageMaker/.xdg/data',
'XDG_CONFIG_HOME': '/home/ec2-user/SageMaker/.xdg/config',
'SHELL': '/usr/bin/bash'
},
'absolute_url': False,
'timeout': 30
}
} The disconnection issue reproduce consistently with other users using it on other sagemaker instances. Here are the chrome console logs: log.ts:421 INFO Resolving connection token (my-sagemaker-id.notebook.eu-west-1.sagemaker.aws)...
log.ts:421 INFO Resolved connection token (my-sagemaker-id.notebook.eu-west-1.sagemaker.aws) after 1 ms
log.ts:421 INFO Creating a socket (renderer-Management-a02104d9-979f-4baa-a958-7c9c1a4f4e96)...
content.js:1 Uncaught Error: Could not establish connection. Receiving end does not exist.
at b (content.js:1:322352)
b @ content.js:1
Show 1 more frame
Show less
log.ts:421 INFO Creating a socket (renderer-Management-a02104d9-979f-4baa-a958-7c9c1a4f4e96) was successful after 122 ms.
/codeserver/stable-2ccd690cbff1569e4a83d7c43d45101f817401dc/static/out/vsda_bg.wasm:1
Failed to load resource: the server responded with a status of 404 (Not Found)
/codeserver/stable-2ccd690cbff1569e4a83d7c43d45101f817401dc/static/out/vsda.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
codeserver/:1 Refused to execute script from 'https://my-sagemaker-id.notebook.eu-west-1.sagemaker.aws/codeserver/stable-2ccd690cbff1569e4a83d7c43d45101f817401dc/static/out/vsda.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
webWorkerExtensionHost.ts:115 The web worker extension host is started in a same-origin iframe!
u @ webWorkerExtensionHost.ts:115
v @ webWorkerExtensionHost.ts:131
start @ webWorkerExtensionHost.ts:124
Hr @ extensionHostManager.ts:139
j @ instantiationService.ts:119
createInstance @ instantiationService.ts:85
f @ extensionHostManager.ts:65
tb @ abstractExtensionService.ts:741
sb @ abstractExtensionService.ts:726
rb @ abstractExtensionService.ts:713
gb @ abstractExtensionService.ts:413
(anonymous) @ extensionService.ts:105
log.ts:421 INFO Creating a socket (renderer-ExtensionHost-6fe7071b-1ae2-46f0-847c-d58496780b2a)...
log.ts:421 INFO [Service Worker] registered
log.ts:421 INFO Creating a socket (renderer-ExtensionHost-6fe7071b-1ae2-46f0-847c-d58496780b2a) was successful after 153 ms.
webWorkerExtensionHostIframe.html:1 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
log.ts:421 INFO Updating additional builtin extensions cache
codeserver/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] received socket close event (wasClean: false, code: 1006, reason: ).
log.ts:441 ERR CloseEvent
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] resolving connection...
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] connecting to WebSocket(my-sagemaker-id.notebook.eu-west-1.sagemaker.aws:443)...
log.ts:421 INFO Creating a socket (renderer-ExtensionHost-6fe7071b-1ae2-46f0-847c-d58496780b2a)...
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] received socket close event (wasClean: false, code: 1006, reason: ).
log.ts:441 ERR CloseEvent
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] resolving connection...
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] connecting to WebSocket(my-sagemaker-id.notebook.eu-west-1.sagemaker.aws:443)...
log.ts:421 INFO Creating a socket (renderer-Management-a02104d9-979f-4baa-a958-7c9c1a4f4e96)...
log.ts:421 INFO Creating a socket (renderer-ExtensionHost-6fe7071b-1ae2-46f0-847c-d58496780b2a) was successful after 219 ms.
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] reconnected!
log.ts:421 INFO Creating a socket (renderer-Management-a02104d9-979f-4baa-a958-7c9c1a4f4e96) was successful after 367 ms.
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] reconnected!
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] received socket close event (wasClean: false, code: 1006, reason: ).
log.ts:441 ERR CloseEvent
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] resolving connection...
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] connecting to WebSocket(my-sagemaker-id.notebook.eu-west-1.sagemaker.aws:443)...
log.ts:421 INFO Creating a socket (renderer-ExtensionHost-6fe7071b-1ae2-46f0-847c-d58496780b2a)...
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] received socket close event (wasClean: false, code: 1006, reason: ).
log.ts:441 ERR CloseEvent
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] resolving connection...
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] connecting to WebSocket(my-sagemaker-id.notebook.eu-west-1.sagemaker.aws:443)...
log.ts:421 INFO Creating a socket (renderer-Management-a02104d9-979f-4baa-a958-7c9c1a4f4e96)...
log.ts:421 INFO Creating a socket (renderer-ExtensionHost-6fe7071b-1ae2-46f0-847c-d58496780b2a) was successful after 166 ms.
log.ts:421 INFO Creating a socket (renderer-Management-a02104d9-979f-4baa-a958-7c9c1a4f4e96) was successful after 287 ms.
log.ts:421 INFO [remote-connection][ExtensionHost][6fe70…][reconnect] reconnected!
log.ts:421 INFO [remote-connection][Management ][a0210…][reconnect] reconnected! |
Strange...does running it with I left code-server open yesterday but could not reproduce, maybe it has something specific to do with AWS. 🤔 I tried running it again now with the same flags you are using (well different port and path) but so far seems stable. I usually see 1006 when there is a reverse proxy that is not configured to proxy web sockets but I am not sure if that is the case here since it does eventually connect. Still, we might need to look at logs on the AWS side to figure it out. |
Actually, one other thing to check, in NGINX for example there is a default timeout of 60 seconds if a web socket has no activity. Maybe AWS has a similar thing? Except, I thought VS Code sent pings to prevent this. Maybe we can check the web socket activity in the browser console to make sure they are being sent. |
Sorry for the delayed response.
Perfect, this is equivalent to
That is the right spot for code-server's logs, specifically the There might be additional logs in AWS, but I am not familiar enough with AWS to know where they are. Probably in the AWS dashboard somewhere.
To check AWS's web socket timeout, I am not sure unfortunately. To check the web socket messages:
You should see at least one message every five seconds or so. |
I am facing the same issue. Please let me know if you guys need some logs from me or find any solution for this. |
Is there an existing issue for this?
OS/Web Information
code-server --version
: code-server: v4.16.1, Code: 1.80.2Steps to Reproduce
Expected
The vscode code client should not be disconnected when the computer has access to internet
Actual
Vscode client page gets disconneted when computer is idle or when browser is out of focus for a while
Logs
No response
Screenshot/Video
Does this bug reproduce in native VS Code?
I did not test native VS Code
Does this bug reproduce in GitHub Codespaces?
I did not test GitHub Codespaces
Are you accessing code-server over a secure context?
Notes
No response
The text was updated successfully, but these errors were encountered: