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

interop hangs inside sshd session initiated by Win32-OpenSSH client #4922

Closed
therealkenc opened this issue Feb 23, 2020 · 3 comments
Closed
Labels
external Issue exists outside of WSL components

Comments

@therealkenc
Copy link
Collaborator

therealkenc commented Feb 23, 2020

  • Your Windows build number: (Type ver at a Windows Command Prompt)

19569 WSL2

  • What you're doing and what's happening

Start sshd in Ubuntu 18.04

$ sudo apt install openssh-server
$ sudo service ssh start

From a Windows CMD prompt, ssh into WSL and run a win32 command via WSL interop:

image

  • What's wrong / what should be happening instead:

The cmd.exe /c echo hangs and does not respond to Ctrl-C on the pty. wsl.exe --shutdown or SIGINT/SIGTERM on the PID recovers.

  • Strace of the failing command

Here is the gist.

[edit: more plausible strace interpretation]
The command loops on a poll() of (looks like) parent fd 0,7,8,9 and AF_VSOCK fd 4, maybe (?) doing some sort of keepalive exchange.

193   execve("/mnt/c/Windows/System32/cmd.exe", ["/mnt/c/Windows/System32/cmd.exe", "/c", "echo", "test"], 0x7ffe028f2430 /* 19 vars */) = 0
...
193   socket(AF_VSOCK, SOCK_STREAM|SOCK_CLOEXEC, 0) = 4
193   bind(4, {sa_family=AF_VSOCK, sa_data="\0\0\377\377\377\377\377\377\377\377\0\0\0\0"}, 16) = 0
...
193   poll([{fd=0, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=4, events=POLLIN}], 5, -1) = 1 ([{fd=0, revents=POLLIN}])
193   poll([{fd=0, events=POLLIN}], 1, -1) = 1 ([{fd=0, revents=POLLIN}])
193   read(0, "\3", 4096)               = 1
193   write(6, "\3", 1)                 = 1
193   poll([{fd=0, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=4, events=POLLIN}], 5, -1

I suspect but can't prove the problem is related to Win32-OpenSSH aka OpenSSH in Windows and ConPTY. The problem does not manifest with a ssh localhost inside WSL, orssh from an external Linux box (say from a VM). This is blocking a generic resolution of question #4911.

@therealkenc therealkenc changed the title interop hangs from sshd session initiated by Win32-OpenSSH client interop hangs inside sshd session initiated by Win32-OpenSSH client Feb 23, 2020
@DHowett-MSFT
Copy link

This is probably resolved with the 8.x builds of the Win32-OpenSSH client. On startup, in “inherit cursor” mode, ConPTY blocks until it receives a cursor location. Old versions of W32-OpenSSH implemented their own VT input stack that couldn’t send the cursor position escapes.

@DHowett-MSFT
Copy link

This does mean that any SSH client running in a terminal that doesn’t support the DEC cursor position report request will experience a similar failure.

@therealkenc
Copy link
Collaborator Author

Yep. Thanks for the quick answer Dustin.

image

@therealkenc therealkenc added the external Issue exists outside of WSL components label Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issue exists outside of WSL components
Projects
None yet
Development

No branches or pull requests

2 participants