gnodet-bot commented on code in PR #30062: URL: https://github.com/apache/camel/pull/30062#discussion_r4579158643
########## components/camel-ftp/src/main/docs/sftp-component.adoc: ########## @@ -362,6 +362,32 @@ consumer is created, also with `poll` and `pollEnrich`, with `IllegalArgumentExc The `readLock` option is not checked when a custom `exclusiveReadLockStrategy` or `processStrategy` is set, as it does not apply then. +=== Timeouts and dead connections + +The SFTP endpoint opens the connection with `connectTimeout` (10 seconds) and uses `soTimeout` (5 minutes) as the read +timeout of the JSch session. When nothing arrives from the server for `soTimeout`, JSch sends a keep-alive message and +waits once more; it drops the session after `serverAliveCountMax` (1 by default) keep-alive messages without an answer. +A connection that went silent (the host is gone, or a firewall or NAT drops the packets) is therefore noticed after +about twice `soTimeout`: about 10 minutes with the defaults, during which the consumer or producer using it waits. +These durations are how JSch behaves, approximately, not guarantees of Camel. + +Lower `soTimeout` to notice it sooner; `soTimeout=15000` notices it after about 30 seconds. As a server that is alive Review Comment: 🔤 **Nit (optional):** `As a server that is alive answers the keep-alive message…` — `As` here means *because*, but can be misread as *while*. Consider replacing with `Because`: `Because a server that is alive answers the keep-alive message, a command that takes longer than \`soTimeout\` does not drop the session.` ########## components/camel-ftp/src/main/docs/ftp-component.adoc: ########## @@ -306,14 +306,52 @@ Camel sets the following exchange properties === About timeouts -The two sets of libraries (see top) have different API for setting -timeout. You can use the `connectTimeout` option for both of them to set -a timeout in millis to establish a network connection. An individual -`soTimeout` can also be set on the FTP/FTPS, which corresponds to using -`ftpClient.soTimeout`. Notice SFTP will automatically use -`connectTimeout` as its `soTimeout`. The `timeout` option only applies -for FTP/FTPS as the data timeout, which corresponds to the -`ftpClient.dataTimeout` value. All timeout values are in millis. +FTP and FTPS use Apache Commons Net and SFTP uses JSch, so the same options map to different settings of each +library. All timeout values are in milliseconds. + +[cols="1,1,4"] +|=== +| Option | Default | What it bounds + +| `connectTimeout` | 10 seconds | Opening the connection to the server (FTP, FTPS and SFTP). + +| `soTimeout` | 5 minutes | FTP/FTPS: each read on the control connection, that is the wait for the reply to every +command (login, `NOOP`, changing directory, listing, the end of each transfer). It corresponds to `ftpClient.soTimeout`. +For SFTP, see xref:sftp-component.adoc#_timeouts_and_dead_connections[Timeouts and dead connections]. + +| `timeout` | 30 seconds | FTP/FTPS only: each read on the data connection (downloads and directory listings). It +corresponds to `ftpClient.dataTimeout`. It does not bound an upload, which only writes to the data connection. Review Comment: 🔤 **Nit (optional):** The relative clause `which only writes to the data connection` has an ambiguous antecedent — `which` could grammatically attach to `upload` or `data connection`. Consider: `It does not bound an upload because an upload only writes to the data connection.` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
