Jump to content


Issue Information

  • #000054

  • 0 - None Assigned

  • Fixed

  • -

  • -

Issue Confirmations

  • Yes (0)No (0)
Photo

Re-connection over SFTP

Posted by Albert21 on 18 March 2010 - 11:19 PM

I am connected to many servers using SFTP. Since version SmartFTP 3.1 I have always had a problem with servers that automatically timeout after the SSH connection has been idle after X Minutes.

If I hit "CTRL-R" it will disconnect and reconnect... but it takes way too long. It is much quicker to close the Tab and re-open a new connection (but then I lose my place).

If I hit F5 before I hit CTRL-R, there is no way for me to reconnect with CTRL-R (it will show a spinning circle forever). I have no choice but to close the tab and open a new session.

If I drag something into the transfer queue (after a connection has timed out) I have to close the tab and re-open (or wait for the CTRL-R process). Then I have to hit the Stop/Start button in the Transfer Queue.

Although SmartFTP is far more advanced than Dreamweaver's FTP client. Dreamweaver auomatically connects to the same SFTP servers without any problem. I wish SmartFTP would work the same way.

I don't quite understand the problem you are seeing. When you hit Ctrl+R or reconnect, SmartFTP immediately reconnects to the server.

Regarding the transfer queue. If the transfer fails, SmartFTP will wait for a certain amount of time (retry time you can configure) until it retries the transfer. The transfer queue uses a connection pool, if means if there is no open connection, SmartFTP will immediately reconnect.

Updating status to: Awaiting Feedback

It works just like you describe on most SFTP servers. But for others, it doesn't (and it is very frustrating). I figured out that my firewall at the hosting center was the root cause. I have another server with an identical SSHD config file (but without a hardware firewall) and the problem wasn't happening there.

I am sure you can fix it on the client-side because I never had a problem using SFTP with Adobe Dreamweaver. Maybe you can just send a blank space every 30 seconds or so?

It seems that the TCP connection is open, but but SSH session is dead. I made progress by setting...
ClientAliveInterval to 30 seconds in
/etc/ssh/sshd_config
http://unixhelp.ed.a...i?sshd_config 5

I use Teraterm for my SSH client and it doesn't timeout after 20 mintues any more. This was also irrating and I am glad it is solved!

SmartFTP still has bugs... it acts different than it did before.
* CTRL-R now re-connects quickly (before it would infinitely try to re-connect).
* The Transfer Queue now automatically re-connects if the File Browser is dead (it didn't before).
* The File Browser does not automatically re-connect if I hit F5. I have to hit CTRL-R. After hitting CTRL-R the screen File Browser appears blank. I have to hit F5. So CTRL-R ... F5 kind of does the trick.
* Smart FTP is timing out very quickly now (after about 2.5 mintues). It used to time-out after about 20 mintues. This is because of the combination of ClientAliveInterval (30 seconds) & ClientAliveCountMax (4)


Setting the ClientAliveInterval fixed my timeout problem with Teraterm, but it didn't fix SmartFTP. Based upon the new timeouts... SmartFTP is not responding to the "client alive" messages... which is part of the SSH protocol. So now the server is proactively dropping the connection. Even if you fix this... it won't solve the problem for people without permission to edit /etc/ssh/sshd_config



[22:27:51] Disconnecting.
[22:27:51] Client closed the connection.
[22:27:51] Resolving host name "xxxxxx"
[22:27:51] Connecting to xxxxxx Port: 22
[22:27:51] SSH-1.99-OpenSSH_3.9p1
[22:27:51] Starting SSH session. Remote Id: "SSH-1.99-OpenSSH_3.9p1"
[22:27:51] SSH protocol version reply. Client Id: "SSH-2.0-SmartFTP"
[22:27:51] Key Exchange Algorithm: diffie-hellman-group-exchange-sha1
[22:27:52] Key exchange completed.
[22:27:52] Host Key Algorithm: ssh-rsa
[22:27:52] Client to Server Encryption: aes256-ctr
[22:27:52] Server to Client Encryption: aes256-ctr
[22:27:52] Session MAC: hmac-sha1
[22:27:52] Client to Server Compression: zlib
[22:27:52] Server to Client Compression: zlib
[22:27:52] Requesting service "ssh-userauth".
[22:27:52] RTT: 150.269 ms
[22:27:52] Authentication request. Method: "none"
[22:27:52] Server supported authentications: publickey,gssapi-with-mic,password
[22:27:52] Authentication request. Method: "password"
[22:27:52] User authentication successful.
[22:27:52] SSH session established.
[22:27:52] Connected to xxxxx.
[22:27:52] Detected Server Software: OpenSSH
[22:27:52] Opening channel 3.
[22:27:52] Channel successfully opened (Local=3, Remote=0).
[22:27:52] SFTP protocol version 3
[22:30:22] SSH session closed. Reason=2. Description=Timeout, your session not responding.
[22:30:23] Server closed connection

Good analysis. I will add support for the client alive message sent by sshd.

SmartFTP handles now the client keep alives from opensshd. Please give it a try:
http://www.smartftp.com/download

Regarding the refresh problem you have reported. I tried to reproduce this:
1. Connect to SFTP over SSH server
2. Login and everything
3. Go to the menu File: Disconnect
4. Focused the shell view (file view)
5. Press F5
6. Browser is reconnecting

Can you verify that you do exactly the same?

Regards,
Mat

Now I am running version 4.0.1092.0. I am have exactly the same problem as before.

If you send me a private email I can give you an FTP account on my server to experiment with.

Here is the SSHD log from the server
Mar 25 18:57:22 s10 sshd[9952]: Accepted password for XXXXX from ::ffff:xxx.xxx.xxx.xxx port 2605 ssh2
Mar 25 18:57:22 s10 sshd[9959]: subsystem request for sftp
Mar 25 18:59:53 s10 sshd[9959]: Disconnecting: Timeout, your session not responding.


Here is an abbrivated log from FTP
[18:57:31] Connected to xxx.xxx.xxx.xxx.
[18:57:31] Detected Server Software: OpenSSH
[18:57:31] Opening channel 2.
[18:57:31] Channel successfully opened (Local=2, Remote=0).
[18:57:31] SFTP protocol version 3
[19:00:01] SSH session closed. Reason=2. Description=Timeout, your session not responding.
[19:00:01] Server closed connection


Here is a abbrieviated log from my packet analyzer.
I can see that the following was happening every 30 seconds.
1) The server sent something encrypted to SmartFTP
2) SmartFTP acknowledges
3) The server acknowledges


"26","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:57:31"
"27","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:57:32"
"28","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:57:32"
"29","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:57:32"
"30","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:57:32"
"31","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:57:32"
"32","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:57:32"
"33","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:57:32"
"34","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:58:02"
"35","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:58:02"
"36","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:58:02"
"37","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:58:32"
"38","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:58:32"
"39","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:58:32"
"40","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:59:02"
"41","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:59:02"
"42","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:59:02"
"43","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:59:32"
"44","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","18:59:32"
"45","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","18:59:32"
"46","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","19:00:02"
"47","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","19:00:02"
"48","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","19:00:02"
"49","IP/TCP","192.168.1.107","MyServer.com (US)","2605","22","19:00:02"
"50","IP/TCP","MyServer.com (US)","192.168.1.107","22","2605","19:00:02"

Ah found the problem. There are 2 different kind of keep alive messages. Nevertheless the server should recognize that if SmartFTP sends back a "not implemented" message that the client is still alive.

Please replace your sfFTPLib.dll with the following updated dll:
32-bit
http://www.smartftp....86/sfFTPLib.dll

64-bit
http://www.smartftp....64/sfFTPLib.dll

That solved the problem! Because it doesn't time out anymore, the other problems I mentioned don't exist.

What about people who can't change the OpenSSH settings on their server? If you need an FTP account behind my firewall to test with... just let me know. I can dissable the connection polling for a while.

Updating status to: Confirmed

The newest build comes with a client side keep alive feature:

32-bit
http://www.smartftp....et/SFTPBeta.exe

64-bit
http://www.smartftp..../SFTPBeta64.exe

The feature can be enable it in the Favorite Properties->SSH dialog. It works the same way as the one (ServerAliveInterval) in the openssh client.

Regards,
Mat

Updating status to: Fixed
Issue fixed in: 4.0.1190.0

Install the latest version: http://www.smartftp.com/download





0 user(s) are reading this issue

0 members, 0 guests, 0 anonymous users