rafaelmaiolla / remote-vscode

A package that implements the Textmate's 'rmate' feature for Visual Studio Code.
MIT License
260 stars 33 forks source link

Failed to start server - getHost NaN #80

Open pe224 opened 4 years ago

pe224 commented 4 years ago

I'm hitting this error and the extension stays in an infinite retry loop:

[Extension Host] [2020-05-29 11:07:14.546] [TRACE] Server - start true
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [TRACE] Server - isOnline
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [DEBUG] Server - isOnline? false
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [TRACE] StatusBarItem - onStarting
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [TRACE] Server - getPort 52698
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [TRACE] Server - getHost NaN
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [TRACE] Server - onServerError { inspect: [Function: inspect] }
console.ts:137 [Extension Host] [2020-05-29 11:07:14.547] [TRACE] StatusBarItem - onError

Even though I set "remote.host": "127.0.0.1" the getHost command seems to return NaN.

If I change the configuration, the setHost is however correctly executed:

[Extension Host] [2020-05-29 11:09:08.060] [TRACE] extension - onConfigurationChange
console.ts:137 [Extension Host] [2020-05-29 11:09:08.060] [TRACE] extension - getConfiguration
console.ts:137 [Extension Host] [2020-05-29 11:09:08.060] [DEBUG] extension - getConfiguration {  onStartup: true,  dontShowPortAlreadyInUseError: true,  port: 52698,  host: '127.0.0.2'}
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] extension - hasConfigurationChanged
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [DEBUG] extension - hasConfigurationChanged? true
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] extension - initialize
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] extension - getConfiguration
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [DEBUG] extension - getConfiguration {  onStartup: true,  dontShowPortAlreadyInUseError: true,  port: 52698,  host: '127.0.0.2'}
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] extension - startServer
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] Server - setPort 52698
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] Server - setHost 127.0.0.2
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] Server - setDontShowPortAlreadyInUseError true
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] Server - start false
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [TRACE] Server - isOnline
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [DEBUG] Server - isOnline? false
console.ts:137 [Extension Host] [2020-05-29 11:09:08.061] [INFO] Server - Starting server
console.ts:137 [Extension Host] [2020-05-29 11:09:08.062] [TRACE] StatusBarItem - onStarting
console.ts:137 [Extension Host] [2020-05-29 11:09:08.062] [TRACE] Server - getPort 52698
console.ts:137 [Extension Host] [2020-05-29 11:09:08.062] [TRACE] Server - getHost NaN
console.ts:137 [Extension Host] [2020-05-29 11:09:08.062] [TRACE] StatusBarItem - setServer
console.ts:137 [Extension Host] [2020-05-29 11:09:08.062] [DEBUG] StatusBarItem - setServer remove all listeners
console.ts:137 [Extension Host] [2020-05-29 11:09:08.062] [TRACE] StatusBarItem - handleEvents
console.ts:137 [Extension Host] [2020-05-29 11:09:08.067] [TRACE] Server - onServerError { inspect: [Function: inspect] }
console.ts:137 [Extension Host] [2020-05-29 11:09:08.067] [TRACE] StatusBarItem - onError
balaji-dutt commented 3 years ago

I was hit by this issue as well, but only after I upgraded to WSL2 on Windows 10. If you are running WSL2, you may have been hit by the issue where HyperV reserves ports above 50000 by default, as per this blog post. I can't find confirmation of this, but another article points to something similar including a possibly botched install of WSL2 as being the root cause. In any case, there seems to be two ways to fix this on Windows 10:

Hope that helps!