Topic ""No session" and no auto reconnect after idle session timeout"

Author Message
tattdogg
[View user's profile]

Joined: 2016-04-22
Posts: 9
Location: Minsk, Belarus
Hi

I suppose I've found the bug.

I have the following code:
Code:
session.Open(options);
Thread.Sleep(TimeSpan.FromMinutes(2)); // this is staging SFTP server and it has 90 seconds session idle timeout (live server has 30 minutes)
session.RemoveFiles("/winscp.log");


My app logic:
1. open session
2. download file - it works fine
3. process file (it can take a few hours) - replaced with Thread.Sleep(2 mins)
4. remove file - it doesn't work when the session idle has expired
5. close session

There is a result log:
Quote:
20/10/2016 13:13:30: winscp> option batch on
20/10/2016 13:13:30: batch on
20/10/2016 13:13:30: reconnecttime 120
20/10/2016 13:13:30: winscp> option confirm off
20/10/2016 13:13:30: confirm off
20/10/2016 13:13:30: winscp> option reconnecttime 120
20/10/2016 13:13:30: reconnecttime 120
20/10/2016 13:13:30: winscp> open "sftp://test1:pass1@ip:22" -hostkey="key" -timeout=15
20/10/2016 13:13:30: Searching for host...
20/10/2016 13:13:30: Connecting to host...
20/10/2016 13:13:31: Authenticating...
20/10/2016 13:13:31: Using username "test1".
20/10/2016 13:13:31: Authenticating with pre-entered password.
20/10/2016 13:13:32: Authenticated.
20/10/2016 13:13:32: Starting the session...
20/10/2016 13:13:32: Session started.
20/10/2016 13:13:32: Active session: [1] test1@ip
20/10/2016 13:13:32: winscp> pwd
20/10/2016 13:13:32: /
20/10/2016 13:15:32: winscp> rm -- "/winscp.log"
20/10/2016 13:15:32: Network error: Software caused connection abort
20/10/2016 13:15:32: Can't get attributes of file '/winscp.log'.
20/10/2016 13:15:32: Session 'test1@ip' closed.
20/10/2016 13:15:32: No session.


No attempts to reconnect to the server. "Session closed. No session" message.

I've checked this case with the other methods (GetFiles, CreateDirectory, FileExists, GetFileInfo) - the same result.
It works only with ListDirectory().
Code:
session.Open(options);
Thread.Sleep(TimeSpan.FromMinutes(2));
session.ListDirectory("/");


Log:
Quote:
20/10/2016 12:51:02: winscp> option batch on
20/10/2016 12:51:02: batch on
20/10/2016 12:51:02: reconnecttime 120
20/10/2016 12:51:02: winscp> option confirm off
20/10/2016 12:51:02: confirm off
20/10/2016 12:51:02: winscp> option reconnecttime 120
20/10/2016 12:51:02: reconnecttime 120
20/10/2016 12:51:02: winscp> open "sftp://test1:pass1@ip:22" -hostkey="key" -timeout=15
20/10/2016 12:51:02: Searching for host...
20/10/2016 12:51:02: Connecting to host...
20/10/2016 12:51:03: Authenticating...
20/10/2016 12:51:03: Using username "test1".
20/10/2016 12:51:03: Authenticating with pre-entered password.
20/10/2016 12:51:04: Authenticated.
20/10/2016 12:51:04: Starting the session...
20/10/2016 12:51:04: Session started.
20/10/2016 12:51:04: Active session: [1] test1@ip
20/10/2016 12:51:04: winscp> pwd
20/10/2016 12:51:04: /
20/10/2016 12:53:04: winscp> ls -- "/"
20/10/2016 12:53:04: Network error: Software caused connection abort
20/10/2016 12:53:09: (A)bort, (R)econnect (5 s): Reconnect
20/10/2016 12:53:09: Searching for host...
20/10/2016 12:53:09: Connecting to host...
20/10/2016 12:53:11: Authenticating...
20/10/2016 12:53:11: Using username "test1".
20/10/2016 12:53:11: Authenticating with pre-entered password.
20/10/2016 12:53:11: Authenticated.
20/10/2016 12:53:11: Starting the session...
20/10/2016 12:53:11: Session started.
20/10/2016 12:53:11: -rw-r--r-- 1 test1 users 20170 Oct 5 12:45:09 2016 winscp.log
20/10/2016 12:53:11: D--------- 0 0 ..


After 'Thread.Sleep' the 'session.Opened' value is always 'true'.

Thanks,
Boris
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26330
Location: Prague, Czechia
Thanks for your report.
It's not really a bug, it's just a way the library is implemented.
I may improve it one day.
tattdogg
[View user's profile]

Joined: 2016-04-22
Posts: 9
Location: Minsk, Belarus
Thanks. Is there any way to track the progress?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26330
Location: Prague, Czechia
I'll add this to the tracker, if more people ask for it.
craig

Guest


I want it Very Happy
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