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

Advertisement

Charles Sorgie
Joined:
Posts:
12

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

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.

Reply with quote

Advertisement

Guest

Re: Too many successive open/closes in a script results in failure

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.

Reply with quote

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Too many successive open/closes in a script results in failure

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?

Reply with quote

Advertisement

You can post new topics in this forum