Skip to content

Remote-SSH connection stalls and never continues #84

Closed

Description

  • VSCode Version: Version 1.34.0-insider (1.34.0-insider) 473af338e1bd9ad4d9853933da1cd9d5d9e07dc9
  • Local OS Version: MacOS Mojave 10.14.4 (18E226)
  • Remote OS Version: PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
    NAME="Debian GNU/Linux"
    VERSION_ID="9"
    VERSION="9 (stretch)"
    ID=debian
  • Remote Extension/Connection Type: SSH

Steps to Reproduce:

  1. Cmd-Shift-P, Remote-SSH: Connect current window to host...

  2. Connection is successful. Remote tools are installed and server is running on remote:

    $ ps -ef | grep code
    root 281660 1 0 16:36 ? 00:00:00 sh /root/.vscode-remote/bin/473af338e1bd9ad4d9853933da1cd9d5d9e07dc9/server.sh --port=0
    root 281669 281660 5 16:36 ? 00:00:00 /root/.vscode-remote/bin/473af338e1bd9ad4d9853933da1cd9d5d9e07dc9/node /root/.vscode-remote/bin/473af338e1bd9ad4d9853933da1cd9d5d9e07dc9/out/remoteExtensionHostAgent.js --port=0

  3. This shows up:
    image
    and it never goes beyond that.

  4. Here's the full log:

    SSH Resolver called for "ssh-remote+redacted.machinename.com"
    SSH Resolver called for host: redacted.machinename.com
    Setting up SSH remote "redacted.machinename.com"
    Using commit id "473af338e1bd9ad4d9853933da1cd9d5d9e07dc9" and quality "insider" for server
    Install and start server if needed
    > Linux redacted.machinename.com 4.14.80 #4 SMP Tue Nov 13 16:27:02 EST 2018 x86_64
    > 
    > mesg: ttyname failed: 
    > Inappropriate ioctl for device
    > bash: cannot set terminal process group (281625): Inappropriate ioctl for device
    > bash: no job control in this shell
    > mesg: ttyname failed: Inappropriate ioctl for device
    > Found existing installation...
    > Printing the current remote environment...
    > PYTHON_EGG_CACHE=/var/tmp/
    > LC_ALL=en_US.utf8
    > LD_LIBRARY_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext
    > SSH_CONNECTION=10.0.7.10 60630 10.0.29.202 22
    > VERTICAINI=/etc/vertica.ini
    > LANG=en_US.UTF-8
    > HISTTIMEFORMAT=%D %T 
    > JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    > S_COLORS=auto
    > USER=root
    > PWD=/root
    > HOME=/root
    > SSH_CLIENT=10.0.7.10 60630 22
    > https_proxy=http://proxy.redacteddomain.com:3128
    > http_proxy=http://proxy.redacteddomain.com:3128
    > 
    > no_proxy=localhost,127.0.0.1,10.*,172.16.*,192.168.*,redacteddomain.com
    > MAIL=/var/mail/root
    > SHELL=/bin/bash
    > LS_OPTIONS=--color=auto
    > TMOUT=3600
    > SHLVL=3
    > LANGUAGE=en_US
    > TERMINFO=/lib/terminfo
    > LOGNAME=root
    > XDG_RUNTIME_DIR=/run/user/0
    > PATH=/opt/vertica/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    > _=/usr/bin/printenv
    > Starting agent...
    > Waiting for server log...
    >  
    > *
    > * Reminder: You may only use this software with Visual Studio family products,
    > * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
    > *
    >  
    > 1bab7624-76d1-4d65-9542-c072562363dd==42089==
    "install" terminal command done
    Received install output: 1bab7624-76d1-4d65-9542-c072562363dd==42089==
    Server is listening on port 42089
    Spawning tunnel with: ssh  redacted.machinename.com -N -L localhost:9456:localhost:42089
    Spawned SSH tunnel between local port 9456 and remote port 42089
    Waiting for ssh tunnel to be ready
    Tunneling remote port 42089 to local port 9456
    Resolving "ssh-remote+redacted.machinename.com" to "localhost:9456", attempt: 1

The machine can be gotten to through ssh, obviously, since VSCode was able install and start the server. The server has internet access through a proxy, but there's a no_proxy that covers the IP space my laptop is in.

I've let it sit for over half an hour, and it never progresses any further.

If I can provide any further details, please let me know.

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Yes

Update: The solution to my specific problem is explained here #84 (comment)

Activity

  1. added
    ssh
    on May 3, 2019
  2. davidwin commented on May 3, 2019

    @davidwin

    Is TCP forwarding enabled on the ssh server? I see the exact same issue where I am testing this and we have forwarding disabled for security reasons.

  3. joeygibson commented on May 3, 2019

    @joeygibson
    Author

    Is TCP forwarding enabled on the ssh server? I see the exact same issue where I am testing this and we have forwarding disabled for security reasons.

    There was nothing in /etc/ssh/sshd_config enabling or disabling it, so I added AllowTcpForwarding yes and restarted sshd, but it made no difference.

  4. davidwin commented on May 3, 2019

    @davidwin

    Hm, have you tried the same ssh command with a different client port (i.e. ssh redacted.machinename.com -N -L localhost:9457:localhost:42089) and then tried accessing the local port? When I do that, the ssh client reports that the operation is "administratively prohibited" or something like that. (Can't test now.)

  5. wqfan commented on May 3, 2019

    @wqfan

    David Windehem (@davidwin) I have the same issue as Joey Gibson (@joeygibson). The tunnel was established:

    "install" terminal command done
    Received install output: 0e53b95e-f0b8-4c7f-85c6-a21823a0c689==45539==
    Server is listening on port 45539
    Spawning tunnel with: ssh  dev-server -N -L localhost:53777:localhost:45539
    Spawned SSH tunnel between local port 53777 and remote port 45539
    Waiting for ssh tunnel to be ready
    Tunneling remote port 45539 to local port 53777
    Resolving "ssh-remote+dev-server" to "localhost:53777", attempt: 1
    

    When I tried to access localhost:53777 from browser, I got "Not Found" on the page.

    Also, VS Code shows an error at right-bottom:

    Failed to connect to the remote extension host server (Error: Connection error: Unauthorized client refused.)
    
  6. joeygibson commented on May 4, 2019

    @joeygibson
    Author

    I ran ssh redacted.machinename.com -N -L localhost:9457:localhost:42089 and then this

    curl localhost:9457
    curl: (56) Recv failure: Connection reset by peer
    
  7. roblourens commented on May 4, 2019

    @roblourens
    Member

    Qingfan Wu (@wqfan) Do you know whether AllowTcpForwarding is disabled?

    Also can you share the logs from the "Remote - SSH" output channel that might explain Unauthorized client refused?

  8. roblourens commented on May 4, 2019

    @roblourens
    Member

    Joey Gibson (@joeygibson) I don't understand, did you try to run a curl command or is that an error that was written?

  9. added
    info-needed
    on May 4, 2019
  10. wqfan commented on May 4, 2019

    @wqfan

    roblourens I have AllowTcpForwarding enabled. I believe my server is able to do TCP forwarding since I have been using SSH channel for other purposes.

    Here is the full output from "Remote - SSH" channel:

    SSH Resolver called for "ssh-remote+dev-server"
    SSH Resolver called for host: dev-server
    Setting up SSH remote "dev-server"
    Using commit id "473af338e1bd9ad4d9853933da1cd9d5d9e07dc9" and quality "insider" for server
    Install and start server if needed
    > bash: no job control in this shell
    > Found existing installation...
    > Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
    > 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)
    > *
    >  
    > bb80525e-2122-4fa5-8e4a-9d91821eeb83==45539==
    "install" terminal command done
    Received install output: bb80525e-2122-4fa5-8e4a-9d91821eeb83==45539==
    Server is listening on port 45539
    Spawning tunnel with: ssh  dev-server -N -L localhost:32546:localhost:45539
    Spawned SSH tunnel between local port 32546 and remote port 45539
    Waiting for ssh tunnel to be ready
    Tunneling remote port 45539 to local port 32546
    Resolving "ssh-remote+dev-server" to "localhost:32546", attempt: 1
    

    Logs from "Log (Window)" channel:

    [2019-05-03 18:02:25.843] [renderer1] [error] Connection error: Unauthorized client refused.: Error: Connection error: Unauthorized client refused.
        at v (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:1544:9)
        at t.onControlMessage.o (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:1542:930)
        at d.fire (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:77:818)
        at a (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:321:48)
        at e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:321:94)
        at d.fire (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:77:818)
        at S._receiveMessage (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:330:65)
        at S._socketDisposables.push._socketReader.onMessage.e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:327:243)
        at d.fire (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:77:818)
        at g.acceptChunk (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:323:801)
        at _register._socket.onData.e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:323:153)
        at Socket.t (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:332:235)
        at Socket.emit (events.js:182:13)
        at addChunk (_stream_readable.js:279:12)
        at readableAddChunk (_stream_readable.js:264:11)
        at Socket.Readable.push (_stream_readable.js:219:10)
        at TCP.onread (net.js:636:20)
    [2019-05-03 18:02:25.844] [renderer1] [error] Cannot read property 'extensions' of null: TypeError: Cannot read property 'extensions' of null
        at e.<anonymous> (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3850:751)
        at Generator.next (<anonymous>)
        at r (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:34:454)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    [2019-05-03 18:02:25.844] [renderer1] [error] Connection error: Unauthorized client refused.: Error: Connection error: Unauthorized client refused.
        at v (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:1544:9)
        at t.onControlMessage.o (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:1542:930)
        at d.fire (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:77:818)
        at a (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:321:48)
        at e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:321:94)
        at d.fire (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:77:818)
        at S._receiveMessage (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:330:65)
        at S._socketDisposables.push._socketReader.onMessage.e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:327:243)
        at d.fire (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:77:818)
        at g.acceptChunk (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:323:801)
        at _register._socket.onData.e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:323:153)
        at Socket.t (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:332:235)
        at Socket.emit (events.js:182:13)
        at addChunk (_stream_readable.js:279:12)
        at readableAddChunk (_stream_readable.js:264:11)
        at Socket.Readable.push (_stream_readable.js:219:10)
        at TCP.onread (net.js:636:20)
    [2019-05-03 18:02:28.207] [renderer1] [error] Could not fetch environment: Error: Could not fetch environment
        at d.getEnvironment.then.e (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3813:413)
    
  11. roblourens commented on May 4, 2019

    @roblourens
    Member

    Warning: bad syntax, perhaps a bogus '-'

    This warning sounds relevant, can you tell me about your remote OS? And possibly the output of ps --version?

  12. wqfan commented on May 4, 2019

    @wqfan

    roblourens Sure.

    $ cat /etc/system-release
    Amazon Linux Bare Metal release 2012.03
    $ ps --version
    procps version 3.2.8
    
  13. roblourens commented on May 4, 2019

    @roblourens
    Member

    Qingfan Wu (@wqfan) please open another issue, I realized that you got through the SSH part successfully and Unauthorized client refused is a different sort of issue. We can continue debugging in another issue.

  14. wqfan commented on May 4, 2019

    @wqfan

    roblourens Sounds good. I opened: #103

  15. lars18th commented on May 5, 2019

    @lars18th

    Hi,

    I have the same problem. And after some debug in the server, I see this behaviour:

    • The Remote-SSH starts the server, and gets the listening port. However, after some seconds the server is closed. I don't know the reason, but the client can't connect because the listening port is closed. However, in the logs is not printed anything about the cause of the server exit.

    So, I suggest:

    1. Print in the server log the cause for the exit.
    2. Add some forwarding control to inform to the client that the server is not running.

    Regards.

  16. 16 remaining items

  17. lars18th commented on May 11, 2019

    @lars18th

    Hi,

    The relevant part is this bug (log copied from the first post) is this:

        > mesg: ttyname failed: 
        > Inappropriate ioctl for device
        > bash: cannot set terminal process group (281625): Inappropriate ioctl for device
        > bash: no job control in this shell
    

    See my comment at #103 (comment)

  18. zbage commented on May 16, 2019

    @zbage

    server: centos
    Failed to connect to the remote extension host server (Error: Connection error: Unauthorized client refused.)

    Remote configuration data at /root/.vscode-remote
    
    *
    * 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
    *
    
    IP Address: 192.168.1.6
    Extension host agent listening on 53753
    Unauthorized client refused.
    Unauthorized client refused.
    
  19. Anudorannador commented on May 17, 2019

    @Anudorannador

    server: centos
    Failed to connect to the remote extension host server (Error: Connection error: Unauthorized client refused.)

    Remote configuration data at /root/.vscode-remote
    
    *
    * 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
    *
    
    IP Address: 192.168.1.6
    Extension host agent listening on 53753
    Unauthorized client refused.
    Unauthorized client refused.
    

    Exactly the same for me : (

  20. syockit commented on May 18, 2019

    @syockit

    Somehow these two values never match.

    a.signedData="186P+yv1gtYPNvobZ2zQw+6cFam2RVgkmkP3v+HZ0AlzVk="
    k="7f19a0be-6c9d-4890-a219-19b42faf0ce5"
    Unauthorized client refused.
    a.signedData="186P+yv1gtYPNvobZ2zQw+6cFam2RVgkmkP3v+HZ0AlzVk="
    k="7f19a0be-6c9d-4890-a219-19b42faf0ce5"
    Unauthorized client refused.
    

    Forcing the signed data to be the same as the UUID made it work for me.


    Ankit Chhabra (@achhabr1)

    Error: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /home/ac043s/.vscode-remote/bin/daf71423252a707b8e396e8afa8102b717f8213b/node_modules/spdlog/build/Release/spdlog.node)

    Please install newer libstdc++ and point LD_LIBRARY_PATH to there from your login script (.bashrc, but somehow in my workplace it was .bash_login)

    P/S: While that solves running the node module, I now have problem starting the CPP extension because it requires a new libc, which cannot be easily overriden using LD_LIBRARY_PATH (due to relocation problem), but that is of course off-topic for this ticket.
    PP/S: Well, managed to make the CPP extension work by unpacking newer glibc to somewhere local, renaming the extension binaries to something else and replace it with a script that runs the new glibc's ld.

  21. roblourens commented on May 19, 2019

    @roblourens
    Member

    The "unauthorized client refused" error is being tracked here: #103

    I don't believe the OP in this issue is having the same issue, this issue should focus on whatever Joey Gibson (@joeygibson) is seeing which we haven't gotten to the bottom of.

    Sorry for neglecting this issue, my best guess is still just that tcp forwarding is somehow disabled based on seeing

    channel 11: open failed: administratively prohibited: open failed

  22. vscodebot commented on May 26, 2019

    @vscodebot

    This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

    Happy Coding!

  23. joeygibson commented on May 29, 2019

    @joeygibson
    Author

    As multiple people suggested, the problem was, in fact, that TCP forwarding was blocked. I tried setting AllowTcpForwarding=yes in /etc/ssh/sshd_config and restarting ssh, but that didn't work. It turned out that -o AllowTcpForwarding=no was present in /etc/default/ssh, which I didn't know to check. Once I removed that option and restarted ssh, everything worked.

  24. lars18th commented on May 29, 2019

    @lars18th

    As multiple people suggested, the problem was, in fact, that TCP forwarding was blocked.

    No, quite the opposite in 99%!
    The forwarding works but the listening port on the server is not running. That's why the connection fails. The real problem is just that: the logs don't print that the server is closed, and the connection through the forwarding fails because the end point is closed.

    Cases like yours only represent 1%. But I'm glad you could work it out. 😉

  25. RyanEwen commented on May 29, 2019

    @RyanEwen

    As multiple people suggested, the problem was, in fact, that TCP forwarding was blocked. I tried setting AllowTcpForwarding=yes in /etc/ssh/sshd_config and restarting ssh, but that didn't work. It turned out that -o AllowTcpForwarding=no was present in /etc/default/ssh, which I didn't know to check. Once I removed that option and restarted ssh, everything worked.

    Tried this on Centos 6 (WHM/cPanel server) without any luck.

  26. Chuxel commented on May 29, 2019

    @Chuxel
    Member

    Ryan Ewen (@RyanEwen) CentOS 6 is due to outdated glibc and libstdc++ libraries in the distribution. That's being discussed in #103.

  27. LiamMahoney commented on Jun 20, 2019

    @LiamMahoney

    Wondering if anyone has any suggestions/best practices concerning allowing TCP Forwarding? The environment I'm working in has set AllowTcpForwarding to NO, and everyone I've reached out to seems hesitant on changing that setting. I've been looking into using the Match User <username> within sshd_config to limit TCP forwarding to my specific user which worked fine in testing. However, it was also suggested to me that I should be using the PermitOpen rule to limit the IPs and ports that TCPForwarding would work on. I haven't been able to figure out how to properly configure that setting to get my remote connection to work. Any suggestions?

    Here's an example of my sshd_config:

    ...
    AllowTcpForwarding no
    Match User <my_username>
         AllowTcpForwarding yes
         PermitOpen <ip_addr:port> #haven't been able to figure out what ip/port combo will work
    
  28. davidwin commented on Jun 20, 2019

    @davidwin

    See if you can get acceptance for setting AllowTcpForwarding to local, which adds very little risk since you have shell access already. At least for now it is sufficient to get VS Code working.
    If you're lucky, your IT department will see the value in developers using VS Code this way and will roll out a configuration change. It worked for me. :)

  29. mrseanryan commented on Jul 5, 2019

    @mrseanryan

    in case it helps anyone:

    I add similar issue, with error like this:

    Waiting for ssh tunnel to be ready
        Tunneling remote port 42089 to local port 9456
        Resolving "ssh-remote+redacted.machinename.com" to "localhost:9456", attempt: 1
    

    I ran this command in Visual Code: F1 -> Remote-SSH: Kill VS Code Server on Host...

    Then re-connecting in Visual Code worked OK.

    It looks like the Visual Code host on server either got in a hung state OR could not be updated ....

  30. locked and limited conversation to collaborators on Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededssh

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions