PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.46k stars 766 forks source link

SFTP Hangs on windows server 2016 and 2019 when running batch script (intermittent) #2046

Open elksson opened 1 year ago

elksson commented 1 year ago

Prerequisites

Steps to reproduce

When running the following sftp commands using a service account (Jenkins build agent). The sftp command hangs and does not exit. We do not observe this hang on the server logs, and we also don't observe this hang on the Linux build agents which don't use this sftp client.

This issue occurs with 7.x - 9.2 of OpenSSH. When we delete sftp.exe (Version 9.2) and replace it with sftp Version (1.0.0) keeping the rest of OpenSSH at version 9.2 Then we no longer observe this issue.

sftp -P 24 -B 65536 -R 128 -i path_to_public_key -b path_to_script username@hostname

contents of script

cd some_dir
put file_path1 fille_name
quit

Expected behavior

SFTP should not hang and should properly exit

Actual behavior

The process hangs and never exits

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.14393.5582
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.5582
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

7.x.x - 9.2.x

Visuals

No response

MysticalMount commented 6 months ago

I believe this may be preventing my Packer builds from running using SSH communicator also. I dont know exactly what command Packer is running, but the connection just hangs when it tries a file transfer.

Im using the bundles OpenSSH version installed by the Windows Capability: SSH-2.0-OpenSSH_for_Windows_7.7