Topic "Help with stopping a reconnect from running indefinitely."

Author Message
cAdler

Guest


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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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.
rmtarget

Guest


and then ? what is the solution ?
it_guy

Guest


prikryl 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

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/ui_pref_resume
See also:
http://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
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 Smile
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
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 Smile

Did you try the option reconnecttime option?
_________________
Martin Prikryl
Guest




prikryl 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:
http://winscp.net/forum/viewtopic.php?t=11119
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Please attach a complete log file showing INDEFINITE reconnect attempt with option batch abort and option reconnect time 1.
_________________
Martin Prikryl
it_guy

Guest


prikryl 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

Description: (none)

myscript.log (240.61 KB) Private file

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Thanks for the log. I can see the problem now.

This issue has been added to the tracker:
http://winscp.net/tracker/show_bug.cgi?id=1169
julesverne

Guest


prikryl wrote:
Thanks for the log. I can see the problem now.

This issue has been added to the tracker:
http://winscp.net/tracker/show_bug.cgi?id=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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
As you can see in the tracker, the status is still "NEW".
julesverne

Guest


Quote:
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.
Chintan

Guest


is there a fix for this or a work around this problem
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