Ticket #159 (closed defect: fixed)
Opened 2 years ago
Last modified 2 years ago
libssh2 takes long time to disconnect from CoreFTP's SFTP service
| Reported by: | qxu | Owned by: | stuge |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2.5 |
| Component: | protocol | Version: | 1.2.4 |
| Keywords: | coreftp server idle timeout | Cc: | |
| Blocked By: | Blocks: |
Description
- Download CoreFTP server from http://www.coreftp.com/server/. Install it on a Windows platform, and set up an SFTP server. Start the service, with the default idle timeout setting as 600 seconds.
- Download the latest libssh2 source package, say, libssh2-1.2.4.tar.gz into a Unix/Linux? box.
- Compile it with debug option enabled, and you will get some binaries in "libssh2-1.2.4/example".
- In the above path, type the command "./sftpdir <coreftp_sftp_server_ip_address> <username> <password> <directory_to_be_listed>".
- Notice that the session will be finished after around 10 mins. This is unbearable.
- Even if the server's idle timeout value is reduced to 1 second, the sftpdir command will still take around 5 to 6 seconds to finish.
- FileZilla? and WinSCP have the same problem.
Attachments
Change History
Changed 2 years ago by qxu
- Attachment sftpdir_idle_timeout.zip added
Changed 2 years ago by stuge
- Attachment sftpdir_idle_timeout_1_sec.log added
Changed 2 years ago by stuge
- Attachment sftpdir_idle_timeout_600_sec.log added
libssh2 trace with idle timeout on server set to 10 minutes
comment:1 Changed 2 years ago by stuge
- Owner set to stuge
- Status changed from new to accepted
Changed 2 years ago by stuge
- Attachment 0001-Send-and-wait-for-channel-EOF-before-sending-SSH_MSG.patch added
Possible fix for this bug, please test it with the CoreFTP server
comment:2 Changed 2 years ago by stuge
Comparing libssh2 behavior with OpenSSH I discovered that libssh2 sends SSH_MSG_CHANNEL_CLOSE without sending SSH_MSG_CHANNEL_EOF and waiting for the other end to also send SSH_MSG_CHANNEL_EOF. RFC4254 explicitly allows sending SSH_MSG_CHANNEL_CLOSE without first sending SSH_MSG_CHANNEL_EOF, but maybe CoreFTP does not support that part of the RFC.
Please apply the patch that I just attached to this ticket and test if it solves the problem.
comment:3 follow-up: ↓ 4 Changed 2 years ago by qxu
Great, Peter! Yes, the problem is fixed. There is no more visible delay. Thanks a lot for your quick fix!
PS: Your fix was sent out 3 days ago. I am sorry to verify it and reply you late, coz I took 2 days' leave last week.
comment:4 in reply to: ↑ 3 Changed 2 years ago by stuge
- Resolution set to fixed
- Status changed from accepted to closed
Replying to qxu:
Yes, the problem is fixed.
Great! Thank you for testing! This is commit 16af813b812aca09c73045288040ddf1a03a2b86

libssh2 trace with idle timeout on server set to 1 second