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

Advertisement

tattdogg
Joined:
Posts:
9
Location:
Minsk, Belarus

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

Hi

I suppose I've found the bug.

I have the following 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:
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().
session.Open(options);
Thread.Sleep(TimeSpan.FromMinutes(2));
session.ListDirectory("/");

Log:
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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: "No session" and no auto reconnect after idle session timeout

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

I'll add this to the tracker, if more people ask for it.

Reply with quote

Advertisement

You can post new topics in this forum