Upload stalls at 100% - Limiting speed fixes

Advertisement

r2blee2
Guest

Upload stalls at 100% - Limiting speed fixes

I am trying to run an automated SFTP on a schedule via a batch script using the WinSCP command line utility.
If the file is more than a 5kb in size it fails with the error below.

Command line entry - (anonymised)
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="%sftplog%.log" /ini=nul ^
  /command ^
    "open sftp://USER:PW%%21@SERVER/ -hostkey=""ssh-rsa 2048 0RfZIfLXm9WeAHEHpBtmZvUbjk7J187TEj0g6bsiy8M="" -timeout=120 -rawsettings SendBuf=0 SshSimple=0" ^
    "lcd ""LOCALDIRECTORY""" ^
    "cd REMOTEDIR" ^
    "rm %UploadType%*.csv" ^
    "put -speed=5 %UploadType%*.csv" ^
    "exit"
Error -
. 2021-06-22 18:38:09.499 Network error: Software caused connection abort
. 2021-06-22 18:38:09.499 Connection was lost, asking what to do.
Things I've tried:
* Added a timeout of 120 seconds
* Changed "Optimize connection buffer size"

Adding the parameter -speed=5 to the put command to limit upload transfer to 5kb/s stops the issue occurring. This is fine for the time being as file sizes are very small but going forward this may cause an issue with timings.

Log file attached - I've anonymised users/servers/directories

Notes:

* The files I'm transferring are very small CSV files (less than 100kb)
* Manually transferring using the GUI works fine.
* Issue occurred at version 5.17. Updated to 5.19 with no resolution.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,228
Location:
Prague, Czechia

Re: Upload stalls at 100% - Limiting speed fixes

Please post /loglevel=1 log files both with and without the speed limit. Can you upload the files successfully in WinSCP GUI or in any other SFTP client? What SFTP server is that?

Reply with quote

r2blee2
Guest

Thanks for your reply.
I can upload all files (large and small) with both WinSCP GUI and another SFTP client.
I am not able to ascertain the remote SFTP type as it is not within my control.

Log with limit attached.
Log without limit attached on next post.

Reply with quote

r2blee2
Guest

Log without limit attached.

Interestingly, the transfer failed here both with and without the limit...

I've tried to anonymise both log files so excuse some strange formatting or login/folder/server entries.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
36,228
Location:
Prague, Czechia

Your SFTP server is probably broken. You can workaround the problem either the way you do (by limiting the speed). Or more reliable would be to set the SFTPMaxPacketSize session settings. It seems that the server can handle packets about 5 KB size correctly, so this should do:
open ... -rawsettings SFTPMaxPacketSize=5120

Reply with quote

Advertisement

You can post new topics in this forum