Help with stopping a reconnect from running indefinitely.

Advertisement

cAdler
Guest

Help with stopping a reconnect from running indefinitely.

I have been working on an automated script using the winscp.com utility to send out files to a selection of servers. I have run into a problem with one specific server that will time out and endlessly try to reconnect. At first I attempted to limit the amount of times the script would attempt to reconnect, when that failed I moved on to attempting to stop it from reconnecting at all.

My current (and admittedly hamfisted) script is the following.
batch           abort     
confirm         off       
reconnecttime   off       
open ftp://USER:PASSWORD@SERVER -passive=on -rawsettings SessionReopenAuto=0 SessionReopenBackground=0 SessionReopenTimeout=0 SessionReopenAutoStall=0 SessionReopenAutoIdle=0
lcd K:\FileLocation
put -transfer=automatic -nopreservetime -nopermissions FileName_*
exit
The logs from this script always end up looking like this:
put -transfer=automatic -nopreservetime -nopermissions FileName_*
FileName.xml |          0 KiB |    0.0 KiB/s | ascii  |   0%
Lost connection.
Timeout detected.

Copying files to remote side failed.

Entering Passive Mode (140,147,249,7,40,18 )
(A)bort, (R)econnect (5 s): Reconnect
Connecting to SERVER ...
Connected with SERVER. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Lost connection.
Timeout detected.

Copying files to remote side failed.

Entering Passive Mode (140,147,249,7,213,8 )
(A)bort, (R)econnect (5 s): Reconnect
Connecting to SERVER ...
Connected with SERVER. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Lost connection.
(...)
I was wondering if anyone had an insight into either changing the default action of the reconnect answer to abort or the proper reconnecttime/-rawsettings to stop the reconnect attempts from continuing indefinitely.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Help with stopping a reconnect from running indefinitely.

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

it_guy
Guest

The same problem. WinSCP.exe does not stop reconnecting. Tried all command line switches, nothing helps.
WinSCP always chooses to "Reconnect" instead of "Abort". My log is attached.

Is there a solution please?

If FTP connection cannot be established, the WinSCP script never stops.
It keeps trying to re-connect again and again, indefinitely, forever.
It has to be killed through Task Manager to stop.

It would be expected that (A)bort and (R)econnect options that are clearly seen in the WinSCP log, would be ruled by option batch abort. But Abort is ignored, and Reconnect is always used. That keeps the script running forever if FTP connection is dead. And that is a problem for automated execution in a batch :)

Reply with quote

martin
Site Admin
martin avatar

@it_guy: In script you can only limit time WinSCP tries to reconnect to shortest possible time (one second) using option reconnecttime 1.

The OP used wrong syntax without option. And he probably believed that value off means no reconnect. But it means no limit on reconnect time.

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Please attach a complete log file showing INDEFINITE reconnect attempt with option batch abort and option reconnect time 1.

Reply with quote

it_guy
Guest

Attached are two logs with the specified options as requested:
myscript.log is the WinSCP log generated with /log="myscript.log" command in my script.
out_echo.log is the WinSCP console output captured with cmd.exe >> out_echo.log.

I had to manually kill the indefinitely reconnecting WinSCP script after 7 minutes.
I hope this helps to resolve the issue.
  • out_echo.log (28.05 KB, Private file)
  • myscript.log (240.61 KB, Private file)

Reply with quote

Advertisement

You can post new topics in this forum