Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.14.3, 2.22.0
-
None
-
Unknown
Description
If SFTP connection settings include both soTimeout and serverAliveInterval the connection keep alive feature does not work as instead of sending keep alive message every serverAliveInterval milliseconds it waits soTimeout milliseconds which is usually much longer delay. As a result server may close the connection as idle and it is unclear why this happened.
Issue details
When we set serverAliveInterval JSCH uses that setting as socket timeout (see com.jcraft.jsch.Session.setServerAliveInterval) in order to get IO exception and send a keep alive message on regular basis (see com.jcraft.jsch.Session.run()). The problem is that when an sftp session is created (org.apache.camel.component.file.remote.SftpOperations.createSession(RemoteFileConfiguration)) camel first sets serverAliveInterval and then sets socket timeout that overwrites the value set by serverAliveInterval setter.
In order to fix this issue it is required to make sure that if serverAliveInterval is set socket timeout is not changed even if provided or as an alternative at least a warning should be logged to clarify what is going on.