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:
27,459
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

Re: Help with stopping a reconnect from running indefinitely.

martin wrote:

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

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?
  • myscript.log (9.02 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,459
Location:
Prague, Czechia

Re: Help with stopping a reconnect from running indefinitely.

it_guy wrote:

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.
First, I do not understand the problem. What is wrong about WinSCP reconnecting once in this particular case?

Anyway, you cannot prevent WinSCP from trying to reconnect at all from script only. You would have to configure this in GUI:
https://winscp.net/eng/docs/ui_pref_resume
See also:
https://winscp.net/eng/docs/faq_script_ini

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.
_________________
Martin Prikryl

Reply with quote

it_guy
Guest

The problem with automatic reconnect is clearly described in the OP post:
how to stop the reconnect attempts from continuing indefinitely

This means that 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
Joined:
Posts:
27,459
Location:
Prague, Czechia

it_guy wrote:

The problem with automatic reconnect is clearly described in the OP post:
how to stop the reconnect attempts from continuing indefinitely

This means that 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 :)
Did you try the option reconnecttime option?
_________________
Martin Prikryl

Reply with quote

Guest

martin wrote:

Did you try the option reconnecttime option?

Yes, I tried:
option reconnecttime off
option reconnecttime 0
option reconnecttime 1

Also tried:
option batch on
option batch abort

All of the above makes no difference: WinSCP keeps reconnecting indefinitely, no way to abort the script if connection is lost.

Also, I found this post, it describes the same problem with Reconnect instead of Abort:
https://winscp.net/forum/viewtopic.php?t=11119

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,459
Location:
Prague, Czechia

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

Reply with quote

it_guy
Guest

martin wrote:

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

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

julesverne
Guest

martin wrote:

Thanks for the log. I can see the problem now.

This issue has been added to the tracker:
https://winscp.net/tracker/1169

Just curious if this bug has been fixed. I've experienced this same issue many times with one of my servers. Only way to kill the attempted upload winscp window is to manually press A twice. I've also set option batch abort and option reconnecttime 120. I know it's not an error persay but I'd like it to stop trying to reconnect regardless. I can provide a log if you like.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,459
Location:
Prague, Czechia

As you can see in the tracker, the status is still "NEW".

Reply with quote

julesverne
Guest

As you can see in the tracker, the status is still "NEW".

I apologize Martin I suppose my question was more of a reminder in case this issue was forgotten as I noticed the status was "NEW" since 2014.

Reply with quote

Guest

Is there a fix planned for this bug?

We have the exact same problem using the .Net assembly. Communicating with a non responsive server will never terminate a file download attempt. There appear to be no way to express that transfers shouldn't be re-tried forever...

Reply with quote

lili
Guest

How can I stop a task when reconnect in Winscp was aborted.

I Used Winscp logged on to server, and tried to access to a directory, and the direcotory has lots of files, so it doesn't open, and continue trying to open, then I abored to reconnect and logged off from Winscp. But when trying to connect to the same server, Winscp is trying to access to the same directory again, and then asked "abort" or reconnect. How can I stop it, so I can go to other directoryies.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,459
Location:
Prague, Czechia

Re: How can I stop a task when reconnect in Winscp was aborted.

lili wrote:

I Used Winscp logged on to server, and tried to access to a directory, and the direcotory has lots of files, so it doesn't open, and continue trying to open, then I abored to reconnect and logged off from Winscp. But when trying to connect to the same server, Winscp is trying to access to the same directory again, and then asked "abort" or reconnect. How can I stop it, so I can go to other directoryies.
Change the initial remote directory:
https://winscp.net/eng/docs/ui_login_directories

Reply with quote

Advertisement

You can post new topics in this forum