vscode 使用 remote-shh 连接 Ubuntu16.04 频繁重连直至奔溃,请问有什么好的解决办法吗?

2021-03-15 16:29:17 +08:00
 Gary2133
连接之后就开始频繁重连,直到错误。
以下是 Remote-SSH 的输出:
[16:21:39.081] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a224c5554227d", attempt 31, (Reconnection)
[16:21:39.082] SSH Resolver called for host: EE
[16:21:39.082] Setting up SSH remote "EE"
[16:21:39.086] Using commit id "f30a9b73e8ffc278e71575118b6bf568f04587c8" and quality "stable" for server
[16:21:39.091] Install and start server if needed
[16:21:39.097] Using SSH config file "C:\Users\Administrator\.ssh\config"
[16:21:39.098] Running script with connection command: ssh -T -D 63661 -F "C:\Users\Administrator\.ssh\config" "LUT" bash
[16:21:39.100] Terminal shell path: C:\Windows\System32\cmd.exe
[16:21:39.485] >
[16:21:39.486] Got some output, clearing connection timeout
[16:21:40.158] > 0895ddbf6228: running
>
[16:21:40.182] > Acquiring lock on /root/.vscode-server/bin/f30a9b73e8ffc278e71575118b6bf568f0458
> 7c8/vscode-remote-lock.root.f30a9b73e8ffc278e71575118b6bf568f04587c8
>
[16:21:40.216] > Found existing installation at /root/.vscode-server/bin/f30a9b73e8ffc278e7157511
> 8b6bf568f04587c8...
> Checking /root/.vscode-server/.f30a9b73e8ffc278e71575118b6bf568f04587c8.log and
> /root/.vscode-server/.f30a9b73e8ffc278e71575118b6bf568f04587c8.pid for a running
> server
> Looking for server with pid: 114975
>
[16:21:40.250] > Found running server...
>
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license ( https://go.microsoft.com/fwlink/?linkid=2077057)
> *
>
> Checking server status on port 33377 with wget
> 0895ddbf6228: start
> SSH_AUTH_SOCK====
> DISPLAY====
> webUiAccessToken====
> listeningOn==33377==
> osReleaseId==ubuntu==
> arch==x86_64==
> tmpDir==/run/user/0==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> connectionToken==11111a1a-1aa1-1111-1aa1-aa11a1a11a11==
> 0895ddbf6228: end
>
[16:21:40.250] Received install output:
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==33377==
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/run/user/0==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==11111a1a-1aa1-1111-1aa1-aa11a1a11a11==

[16:21:40.250] Remote server is listening on 33377
[16:21:40.250] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":33377},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/0","platform":"linux","connectionToken":"11111a1a-1aa1-1111-1aa1-aa11a1a11a11"},"installUnpackCode":""}
[16:21:40.251] Starting forwarding server. localPort 63663 -> socksPort 63661 -> remotePort 33377
[16:21:40.252] Forwarding server listening on 63663
[16:21:40.252] Waiting for ssh tunnel to be ready
[16:21:40.253] Tunneled 33377 to local port 63663
[16:21:40.254] Resolved "ssh-remote+7b22686f73744e616d65223a224c5554227d" to "127.0.0.1:63663"
[16:21:40.254] [Forwarding server 63663] Got connection 0
[16:21:40.260] ------




[16:21:40.307] [Forwarding server 63663] Got connection 1
[16:21:44.371] >
[16:21:48.698] >
[16:21:48.845] >
[16:21:50.030] >
[16:21:52.022] >
[16:22:10.062] >
[16:22:10.143] >
[16:22:11.270] >
[16:22:15.012] >
[16:22:32.544] >
[16:22:37.967] >
[16:22:38.031] >


*Remote-SSH server 的日志*
[2021-03-15 15:38:20.640] [remoteagent] [info]

*
* Visual Studio Code Server
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license https://aka.ms/vscode-remote/license
*


[2021-03-15 15:38:20.640] [remoteagent] [info] Extension host agent started.
[2021-03-15 15:38:21.103] [remoteagent] [error] [127.0.0.1][b21b8e7a][ManagementConnection] Unknown reconnection token.
[2021-03-15 15:38:21.141] [remoteagent] [error] [127.0.0.1][b25874c4][ExtensionHostConnection] Unknown reconnection token.
[2021-03-15 15:57:14.387] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] New connection established.
[2021-03-15 15:57:14.397] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] New connection established.
[2021-03-15 15:57:14.504] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] <116226> Launched Extension Host Process.
[2021-03-15 15:58:19.876] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 15:58:19.899] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 15:58:42.879] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 15:59:05.899] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 15:59:28.877] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:04:24.862] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:00:13.515] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:05:07.783] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:05:29.137] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:05:29.149] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:05:50.407] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:06:11.723] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:02:00.013] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:02:26.208] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:05:47.435] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:10:41.682] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:11:02.953] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:11:24.230] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:11:45.476] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:12:11.622] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:12:32.879] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:13:00.825] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:08:49.203] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:09:44.802] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:10:05.838] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:10:34.228] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:10:34.258] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:10:55.170] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:16:03.148] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:16:30.154] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:12:22.183] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:17:37.372] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] The client has reconnected.
[2021-03-15 16:18:12.865] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:18:34.117] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:18:55.384] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:19:16.689] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:19:37.874] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:19:59.175] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:20:20.479] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:20:41.777] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.
[2021-03-15 16:21:03.122] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] The client has reconnected.

我尝试了网上所有方法还是不行,有的说是中文插件问题,有的说是 GO 插件问题,我都卸载了所有插件还是不起效。
请问有什么好的解决方法或者排查问题的办法吗?感激不尽。

版本信息:
Version: 1.54.1 (system setup)
Commit: f30a9b73e8ffc278e71575118b6bf568f04587c8
Date: 2021-03-04T22:38:31.419Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 6.3.9600
3918 次点击
所在节点    Visual Studio Code
13 条回复
norz
2021-03-15 17:13:57 +08:00
[2021-03-15 15:57:14.387] [remoteagent] [info] [127.0.0.1][e47770ee][ManagementConnection] New connection established.
[2021-03-15 15:57:14.397] [remoteagent] [info] [127.0.0.1][2c5fe2d0][ExtensionHostConnection] New connection established.

这两次新连接时间怎么这么接近,你这个有点像我前段时间配 openvpn,相同账户连续登录,导致互相把对方踢下线的情况
Gary2133
2021-03-15 17:19:56 +08:00
@norz #1 同时使用了 Xshell 使用同一个账户登录,我试试看吧。但是之前同时使用 vscode 和 Xshell 连接阿里云的 Ubuntu18.04 就没有出现过问题。实在不知道怎么排查了。
oott123
2021-03-15 18:18:23 +08:00
内存够不够
daijia0
2021-03-15 18:22:03 +08:00
试试换一个 ssh,Win10 自带的就有这个问题
另外,语言设置成英语再试试
datou
2021-03-15 18:27:31 +08:00
目标机配置太低了吧?

vscode remote 起码 2G 内存起步才行
Gary2133
2021-03-15 19:09:30 +08:00
@daijia0 #4 老本子,win8.1 的系统,使用的 GIT 的 SSH,版本是 2.28.0 。
@datou @oott123 目标机内存是 4 核 8G,应该没有问题。
Gary2133
2021-03-15 19:12:56 +08:00
@Gary2133 #6 SSH 版本是 OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020 上边写错了,那是 GIT 的版本。
xy2401
2021-03-16 08:38:45 +08:00
@datou 不会吧。不就是个 ssh 吗?为什么还要 2G 这么大
kiracyan
2021-03-16 09:47:12 +08:00
@xy2401 vs code 的 remote 很消耗性能
pota
2021-03-16 10:33:55 +08:00
@xy2401 #8 vscode remote 本质上就是在服务器运行 vscode 所以对目标服务器性能还是有点要求的
twotiger
2021-03-16 10:52:48 +08:00
没遇到这种问题,但是可以试试老办法,重启,换个电脑连服务器
alexmy
2021-03-16 10:56:05 +08:00
对面机器如果性能差,会经常断开连不上,后来我把扫描什么的关了一堆,认认真真的配置了一编 vscode 。
norz
2021-03-19 09:50:41 +08:00
@Gary2133 这个是 ssh 的配置,你可以搜一下怎么改,允许同名账户登录

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/761817

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX