Skip to content

SSh seems to randomly disconnect due to "connection reset"particulary on OS X #4448

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

Closed
zersiax opened this issue Feb 9, 2021 · 3 comments
Closed
Labels
ssh Issue in vscode-remote SSH

Comments

@zersiax
Copy link

zersiax commented Feb 9, 2021

  • VSCode Version: 53
  • Local OS Version: 2004
  • Remote OS Version: 11.2
  • Remote Extension/Connection Type: SSH

Steps to Reproduce:

  1. Connect from Windows VS Code to a host running OS X, in my case it's one running on an M1 chip
  2. Open a folder. In my case, I opened a React-native project right after creating it from the generator command.
  3. Wait. After two or so minutes connection is lost. In my case I have key-based auth, so it reconnects again. And then loses connection again. And does that over and over.

Does this issue occur when you try this locally?: N/A
Does this issue occur when you try this locally and all extensions are disabled?: N/A

extra info

I have been seeing connection drops on several hosts over the last few months and having trouble tracking down the cause, as it doesn't always present the same way and yet the issues seem related:

  • On a mac host, it's reproduceable that when a somewhat large folder, say, a node project, is opened, connection will be lost after a few minutes. This host is within my local network, and is using key-based authentication. I have the "show Terminal" setting set to true and can therefore see the output of the ssh process, but that has nothing anomalous in it. Unfortunately, I seem to be unable to grab the logs from the developer tools as this process is currently not screenreader-accesssible.
  • On another host issues are more intermittent; a ubuntu 20.04-based VPS will almost at random start exhibiting similar behavior, at times ramping up so strongly that a connection can't be established at all, or for a couple of seconds at the very most.

In both cases, I have an ssh terminal over wsl2 open which does not disconnect and has no issues whatsoever.
If there are more ideas to debug this, or fix this, I'd love to hear it as this is extremely detrimental to productivity. This essentially means autocomplete barely works, saving is extremely unpredictable etc.

@zersiax
Copy link
Author

zersiax commented Feb 9, 2021

In case it's relevant, here's the output from around the first connection reset:

[16:50:29.938] Remote server is listening on 51851
[16:50:29.939] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":51851},"osReleaseId":"Darwin","arch":"arm64","webUiAccessToken":"","sshAuthSock":"","tmpDir":"/tmp","platform":"macOS","connectionToken":"1aa11111-a11a-11aa-a111-1a1aa111a111"},"installUnpackCode":""}
[16:50:29.939] ** Note: Support for architecture "arm64" is in preview **
[16:50:29.943] Starting forwarding server. localPort 11875 -> socksPort 11868 -> remotePort 51851
[16:50:29.946] Forwarding server listening on 11875
[16:50:29.946] Waiting for ssh tunnel to be ready
[16:50:29.951] Tunneled 51851 to local port 11875
[16:50:29.951] Resolved "ssh-remote+192.168.178.42" to "127.0.0.1:11875"
[16:50:29.954] [Forwarding server 11875] Got connection 0
[16:50:29.970] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"Darwin","arch":"arm64","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"1","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"success"},"measures":{"resolveAttempts":1,"retries":1,"timing.totalResolveTime":16427,"timing.preSshTime":189,"timing.establishSshTime":16077,"timing.scriptTime":16207}}
[16:50:29.975] ------




[16:50:30.145] [Forwarding server 11875] Got connection 1
[16:50:30.181] [Forwarding server 11875] Got connection 2
[16:50:41.713] TELEMETRY: {"eventName":"extraInfo","properties":{"remoteCloud":""},"measures":{}}
[16:52:11.108] "install" terminal received data: "Connection reset by 192.168.178.42 port 22�[0K�[?25l
�[0K�[?25h"
[16:52:11.346] "install" terminal command done
[16:52:11.348] Install terminal quit with output: Connection reset by 192.168.178.42 port 22
[16:52:16.255] [Forwarding server 11875] Got connection 3
[16:52:18.296] Failed to set up socket for dynamic port forward to remote port 51851: connect ECONNREFUSED 127.0.0.1:11868. Is the remote port correct?
[16:52:19.053] ------




[16:52:19.053] SSH Resolver called for "ssh-remote+192.168.178.42", attempt 2, (Reconnection)

yadda yadda yadda

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Feb 9, 2021
@zersiax
Copy link
Author

zersiax commented Feb 14, 2021

Log from the dev tools:

console.ts:137 [Extension Host] (node:40004) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
b @ console.ts:137
abstractExtensionService.ts:718 [onecentlin.laravel5-snippets]: Unknown language in `contributes.laravel5-snippets.language`. Provided value: blade
_logMessageInConsole @ abstractExtensionService.ts:718
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope source.ruby.
Old grammar file: file:///c%3A/Program%20Files/Microsoft%20VS%20Code/resources/app/extensions/ruby/syntaxes/ruby.tmLanguage.json.
New grammar file: file:///c%3A/Users/flori/.vscode/extensions/wingrunr21.vscode-ruby-0.28.0/syntaxes/ruby.cson.json
register @ TMScopeRegistry.ts:45
localProcessExtensionHost.ts:265 Extension Host
localProcessExtensionHost.ts:266 Debugger attached.
log.ts:197   ERR read ECONNRESET: Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] resolving connection...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] connecting to 127.0.0.1:14664...
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] resolving connection...
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] connecting to 127.0.0.1:14700...
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] reconnected!
log.ts:197   ERR [remote-connection] The time limit has been reached for a connection. Error:
log.ts:197   ERR Error: Time limit reached
    at remoteAgentConnection.ts:594
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] A network error occurred while trying to reconnect, will try again...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] waiting for 5 seconds before reconnecting...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] resolving connection...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] connecting to 127.0.0.1:14700...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] reconnected!
DevTools failed to load SourceMap: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/8490d3dde47c57ba65ec40dd192d014fd2113496/node_modules/windows-process-tree/lib/index.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
log.ts:197   ERR read ECONNRESET: Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
localProcessExtensionHost.ts:265 Extension Host
localProcessExtensionHost.ts:266 Debugger attached.
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] resolving connection...
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] connecting to 127.0.0.1:14728...
log.ts:185  INFO [remote-connection][Management   ][172d9…][reconnect] reconnected!
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] resolving connection...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] connecting to 127.0.0.1:14728...
log.ts:185  INFO [remote-connection][ExtensionHost][d8ad9…][reconnect] reconnected!
localProcessExtensionHost.ts:265 Extension Host
localProcessExtensionHost.ts:266 Debugger attached.

This happens every few minutes or so. I set a keepAlive of 20 seconds which worked for a while but we're back to this, now.

@bamurtaugh
Copy link
Member

Thanks for reporting @zersiax. We also have related issues tracking disconnects and the behavior to handle them: https://github.com/microsoft/vscode-remote-release/issues/1087, #1257 (related to large folder issue you mention), #3096.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

3 participants