iterate-ch / cyberduck

Cyberduck is a libre FTP, SFTP, WebDAV, Amazon S3, Backblaze B2, Microsoft Azure & OneDrive and OpenStack Swift file transfer client for Mac and Windows.
https://cyberduck.io/
GNU General Public License v3.0
3.05k stars 278 forks source link

SSH ServerAliveInterval ignored by Cyberduck – idle connection timeout prevents editing a file in external editor #15895

Open saudepp opened 1 month ago

saudepp commented 1 month ago

It seems Cyberduck ignores directives "ServerAliveInterval" set in: ~/.ssh/config

ServerAliveInterval 120
ServerAliveCountMax 10

If I e.g. connect via SFTP to a remote server and open a file in an external editor, I want to edit this file and after some time save it remotely. It seems that after around 10 minutes, the SFTP connection in Cyberduck is lost, so the ServerAliveInterval of 120 seconds (intended to refresh the connection to the remote server) seems to be ignored.

When I then want to save the file in the external editor, the status in Cyberduck is "{file name} preparing (overwrite)" and a spinning wheel, see screenshot: Bildschirmfoto 2024-04-28 um 11 59 43

Then the connection to the server is retried after 10 seconds (as defined in the Cyberduck connection setting), but fails in the end with a dialogue, see screenshot:

Bildschirmfoto 2024-04-28 um 12 00 26

When I click on Cancel ("Abbrechen"), Cyberduck reconnects to the server just fine. I have to reopen the file in the external editor, and then save my changes ...

I don't post my verbose loge file here, due to sensitive information contained.

macOS 14.4.1 Cyberduck 8.8.2

tatze96 commented 1 month ago

Please send the mentioned log file with the ticket reference GH-15895 to support@cyberduck.io for further investigation.

AliveDevil commented 3 weeks ago

Cyberduck by default sends out keepalive@openssh.com-requests, configurable with

ssh.heartbeat.provider=keep-alive

with a default value of

ssh.heartbeat.seconds=60

Cyberduck ignores the ServerAliveInterval.

Tested this against a local OpenSSH server (on Debian), with configuration

$ sudo sshd -T | grep -i alive
clientaliveinterval 120
clientalivecountmax 3
tcpkeepalive yes

I don't see any issue with having TextEdit on a text file open for extended periods of time (had it open, not doing anything for 14 minutes:

2024-05-17 12:59:14,977 [sshj-PacketReader-manage.lab.xc/172.19.216.6:22-1715942888984] DEBUG net.schmizz.sshj.sftp.PacketReader - Received STATUS packet
2024-05-17 12:59:14,977 [sshj-PacketReader-manage.lab.xc/172.19.216.6:22-1715942888984] DEBUG net.schmizz.concurrent.Promise - Setting <<sftp / 82>> to `Buffer [rpos=5, wpos=24, size=24]`
2024-05-17 13:03:15,094 [sshj-Reader-manage.lab.xc/172.19.216.6:22-1715942878957] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Got chan request for `keepalive@openssh.com`
2024-05-17 13:07:15,220 [sshj-Reader-manage.lab.xc/172.19.216.6:22-1715942878957] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Got chan request for `keepalive@openssh.com`
2024-05-17 13:11:15,345 [sshj-Reader-manage.lab.xc/172.19.216.6:22-1715942878957] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Got chan request for `keepalive@openssh.com`
2024-05-17 13:13:42,819 [Thread-92] DEBUG net.schmizz.sshj.connection.channel.Window$Remote - Consuming by 42 down to 2094803