MykhailoVlakh created CAMEL-12631:
-------------------------------------

             Summary: SFTP: Socket timeout overwrites Server Alive Interval
                 Key: CAMEL-12631
                 URL: https://issues.apache.org/jira/browse/CAMEL-12631
             Project: Camel
          Issue Type: Bug
          Components: camel-sftp
    Affects Versions: 2.14.3, 2.22.0
            Reporter: MykhailoVlakh


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.
h4. 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to