Skip to content
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

Failed to start server - getHost NaN #80

Open
pe224 opened this issue May 29, 2020 · 1 comment
Open

Failed to start server - getHost NaN #80

pe224 opened this issue May 29, 2020 · 1 comment

Comments

@pe224
Copy link

pe224 commented May 29, 2020

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
Copy link

balaji-dutt commented Feb 13, 2021

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:

  • Option 1: If you have Administrator privileges on your Windows machine
    Run the following commands to force Hyper-V to use a different port range, for example:
netsh int ipv4 set dynamic tcp start=32768 num=16384
netsh int ipv6 set dynamic tcp start=32768 num=16384

The above commands forces Hyper-V to use a max. of 16000 ports, starting from 32768. If you have other apps that possibly conflict with this range, change the start and num parameters as per your liking. In either case, reboot your machine and check if this extension now starts up correctly.

  • Option 1: If you do not have Administrator privileges on your Windows machine
    1. is to change the listening port that the extension uses in Extension Settings. I had success with setting it to something like 45200. But ensure this port does not conflict with anything else.
    2. Create ~/.rmate.rc in your remote machine as documented in the rmate repo.
    3. Change your SSH tunnel settings to forward the new port.

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants