Topic "Too many successive open/closes in a script results in failure"

Author Message
Charles Sorgie
[View user's profile]

Joined: 2015-03-05
Posts: 1
WinSCP Version 5.9 (Build 6786) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
Unclear when problem started.
Scripting

I have a script that looks like this:

====================
option batch abort
option confirm off

open <sitename1>
lcd "<directory1>"
get *.* -preservetime -delete
close

open <sitename2>
lcd "<directory2>"
get *.* -preservetime -delete
close

...

open <sitename(n)>
lcd "<directory(n)>"
get *.* -preservetime -delete
close

exit
====================

There are variations of the get command but basically the script open, gets, and closes a lot of sessions. Only one session is open at a time.

The problem appears to be that after about 20 open/closes the script fails as follows:

====================
Looking up host "<hostname>" for SSH connection
Connecting to xxx.xxx.xxx.xxx port 22
We claim version: SSH-2.0-WinSCP_release_5.9
Network error: Software caused connection abort
====================

If I comment out the portion of the script that fails, the next portion fails. If I comment out everything before the portion that fails, the failed portion and the remainder of the script completes successfully:

====================
Script: close
Closing connection.
Sending special code: 12
Sent EOF message
====================

The only solution I have at this point is to break the script up into separate tasks.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Is it the same host or different each time?
Guest




martin wrote:
Is it the same host or different each time?


Same host each time.

Configuration was HKCU which worked because task is running as local admin. Switched to INI as part of debugging process, no change.

All sites can be opened via the graphical interface without issue.

Failed access never makes it to the server logs because SSH handshake fails.
Guest




Update: I broke the job up into separate bat files such that Win_SCP is invoked in turn for each site. This still produced the same error at the 16th site. I then added a timeout 10 between the invocations and the task is completing successfully. I haven't tried less than 10 seconds. So it seems the VM running the task is getting bogged down somehow. A simple (and general) fix might be to add a timeout script command. Hope this helps.
Guest




...or I suppose Win_SCP could wait and retry the operation? Curious to see what you discover.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
I suppose that the SSH server or the machine firewall (or iptables or similar tool) just blocks too many connection attempts from the same client. It's quite common.

Why are you re-connecting the same host? Why don't you reuse the connection?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License