Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12631

SFTP: Socket timeout overwrites Server Alive Interval

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.14.3, 2.22.0
    • Fix Version/s: 2.21.4, 2.22.3, 2.23.0
    • Component/s: camel-sftp
    • Labels:
      None
    • Estimated Complexity:
      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.

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              mvlakh MykhailoVlakh
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: