Skip to content

Nested SSH process hanging when launched with pipes #1748

Open

Description

@jameymorris

"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

Activity

  1. mtoftdal commented on Oct 10, 2024

    @mtoftdal

    jameymorris, did you find a work-around for this?
    It seems I'm running into the exact same issue after a recent update to the Windows Server 2019 update of OpenSSH.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions