Search code examples
sftpscpwinscp

WinSCP Network error: Software caused connection abort


I have a scheduled job to perform secure file transfers daily through WinSCP. The flow starts with 2 ssrs file share subscriptions which drops 2 files in a local directory. Then the sql server agent job I scheduled kicks off a powershell script which initiates the winscp sftp transfer of the 2 files to the remote SFTP server.

The job and file transfers were all working fine and dandy for 2 months until randomly last week when the job started failing on some days (but not others). The logs show a cryptic network error "Software caused connection abort". I've checked winscp's support docs here https://winscp.net/eng/docs/message_software_caused_connection_abort, here https://winscp.net/eng/docs/message_unexpected_close here https://winscp.net/eng/docs/faq_connection_refused and other sources here https://www.hostingride.in/content/solved-network-error-software-caused-connection-abort-winscp-error-putty-keepalives

Based on suggestions found I:

a) Added an exception to windows firewall to allow winscp through.

b) Enabled "Executing dummy protocol commands" under Keepalives in WinSCP Advanced Site Settings

c) Increased the server response timeout and seconds between keepalives to 360 seconds each

None of these fixed the problem. And oddly the file transfer is not consistently failing every day. Running the job repeatedly (same code) fails usually but occasionally succeeds (see powershell screenshot attached)

If anyone is familiar with how to fix this issue please let me know. See log entry and powershell screenshot attached.

. 2019-04-25 16:39:28.997 --------------------------------------------------------------------------
. 2019-04-25 16:39:28.998 Looking up host "REDACTED" for SSH connection
. 2019-04-25 16:39:29.002 Connecting to REDACTED port 22
. 2019-04-25 16:39:29.062 We claim version: SSH-2.0-WinSCP_release_5.13.1
. 2019-04-25 16:39:29.122 Network error: Software caused connection abort
. 2019-04-25 16:39:33.594 --------------------------------------------------------------------------
. 2019-04-25 16:39:33.594 WinSCP Version 5.13.1 (Build 8265) (OS 6.2.9200 - Windows Server 2012 Standard)
. 2019-04-25 16:39:33.594 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2019-04-25 16:39:33.594 Log level: Normal
. 2019-04-25 16:39:33.594 Local account: REDACTED\ebarnes
. 2019-04-25 16:39:33.594 Working directory: D:\Div32_Daily_Reports
. 2019-04-25 16:39:33.594 Process ID: 205196
. 2019-04-25 16:39:33.595 Command-line: "D:\Div32_Daily_Reports\WinSCP.exe" /console=5.13.1 /consoleinstance=_5176_503 "/script=SyncTo_bics_inventory_v2.txt" "/log=D:\Div32_Daily_Reports\winscp_log_bics_inventory.txt" 
. 2019-04-25 16:39:33.595 Time zone: Current: GMT+0 (Coordinated Universal Time), No DST
. 2019-04-25 16:39:33.595 Login time: Thursday, April 25, 2019 4:39:33 PM
. 2019-04-25 16:39:33.595 --------------------------------------------------------------------------
. 2019-04-25 16:39:33.595 Script: Retrospectively logging previous script records:
> 2019-04-25 16:39:33.595 Script: option batch abort
< 2019-04-25 16:39:33.595 Script: batch           abort     
> 2019-04-25 16:39:33.595 Script: option confirm off
< 2019-04-25 16:39:33.595 Script: confirm         off       
> 2019-04-25 16:39:33.595 Script: open sftp://a427721x:***@REDACTED -hostkey="ssh-rsa 2048 ad:b3:c7:a1:ff:43:5c:71:d6:a7:50:6c:1a:c8:d1:70"
. 2019-04-25 16:39:33.595 --------------------------------------------------------------------------
. 2019-04-25 16:39:33.595 Session name: a427721x@REDACTED (Ad-Hoc site)
. 2019-04-25 16:39:33.595 Host name: REDACTED (Port: 22)
. 2019-04-25 16:39:33.595 User name: a427721x (Password: Yes, Key file: No, Passphrase: No)
. 2019-04-25 16:39:33.595 Tunnel: No
. 2019-04-25 16:39:33.595 Transfer Protocol: SFTP
. 2019-04-25 16:39:33.595 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2019-04-25 16:39:33.595 Disable Nagle: No
. 2019-04-25 16:39:33.595 Proxy: None
. 2019-04-25 16:39:33.595 Send buffer: 262144
. 2019-04-25 16:39:33.595 SSH protocol version: 2; Compression: No
. 2019-04-25 16:39:33.595 Bypass authentication: No
. 2019-04-25 16:39:33.595 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2019-04-25 16:39:33.595 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2019-04-25 16:39:33.595 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2019-04-25 16:39:33.595 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2019-04-25 16:39:33.595 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2019-04-25 16:39:33.595 Simple channel: Yes
. 2019-04-25 16:39:33.595 Return code variable: Autodetect; Lookup user groups: Auto
. 2019-04-25 16:39:33.595 Shell: default
. 2019-04-25 16:39:33.595 EOL: LF, UTF: Auto
. 2019-04-25 16:39:33.595 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2019-04-25 16:39:33.595 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2019-04-25 16:39:33.595 SFTP Bugs: Auto,Auto
. 2019-04-25 16:39:33.595 SFTP Server: default
. 2019-04-25 16:39:33.595 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2019-04-25 16:39:33.595 Cache directory changes: Yes, Permanent: Yes
. 2019-04-25 16:39:33.595 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2019-04-25 16:39:33.595 DST mode: Unix
. 2019-04-25 16:39:33.595 --------------------------------------------------------------------------
. 2019-04-25 16:39:33.596 Looking up host "REDACTED" for SSH connection
. 2019-04-25 16:39:33.600 Connecting to REDACTED port 22
. 2019-04-25 16:39:33.660 We claim version: SSH-2.0-WinSCP_release_5.13.1
. 2019-04-25 16:39:33.720 Network error: Software caused connection abort
. 2019-04-25 16:39:37.840 --------------------------------------------------------------------------

enter image description here


Solution

  • Answer: Being that this was a server-side issue, this item has no immediate solution. The solution is to confirm with the other party that their SFTP server is configured properly becuause the client-side requests are being initiated properly.