Win32-OpenSSH icon indicating copy to clipboard operation
Win32-OpenSSH copied to clipboard

Nested SSH process hanging when launched with pipes

Open jameymorris opened this issue 4 years ago • 1 comments
trafficstars

"OpenSSH for Windows" version OpenSSH_for_Windows_8.1p1

Server OperatingSystem Windows 10.0.17763

Client OperatingSystem Windows 10.0.17763

What is failing Applications/scripts being run through SSH that then launch an SSH process through CreateProcess, subprocess, Popen, etc. using pipes fail to complete as expected. This is occurring in both a C++ application and a Python script. Attached is my Python script for recreating. The script is being launched with the following line:

ssh localhost python C:\Work\test\popen.py

I have tried a test program similar to Creating a Child Process with Redirected Input and Output and cannot find any combination of application-side updates or SSH/SSHd options and configuration changes.

If I kill the nested SSH process, the calling script or application print the expected output and finish gracefully. Looking at the debug output from the offending SSH process, the last line I see is:

debug2: channel 0: chan_shutdown_write (i3 o1 sock -1 wfd 5 efd 6 [write])

And I understand from a successful run that the following line SHOULD be:

debug2: channel 0: output drain -> closed

So it seems that my nested SSH call cannot properly close its output.

Expected output >test test test done

Actual output Hangs until I manually kill the nested SSH process.

popen.txt

jameymorris avatar Mar 04 '21 17:03 jameymorris