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

SFTP sometimes doesn't receive all files



    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.7.3
    • 3.11.1, 3.12.0
    • camel-ftp
    • None
    • I'm reproducing this on my own computer and a SFTP server running on a Docker container locally.

    • Unknown


      I have following Camel route, created by a RoutingBuilder:

      new org.apache.camel.builder.RouteBuilder() {
        void configure() {

      This route is the only one which I place on my CamelContext and than I start the CamelContext.

      I'm doing a test on my local machine to send 50 files through this route to a remote SFTP server. Most of the time, all files arrive, but sometimes 1 file seems to be missing.

      My program doesn't notice the failure of sending. But during debugging I found something interesting that happened.

      That one specific file which is missing throws in the camel library an SFTPException at the method existsFile (SftpOperations.java:1046).

      The exception contains only reason 4: message but the exception contains another exception. The wrapped exception contain following exception message: java.io.IOException: Pipe Closed.

      Camel wraps the exception in a GenericFileOperationFailedException and throws it to the method which called SftpOperations, GenericFileProducer (GenericFileProducer.java:135).
      That exception arrives in the tr/catch block of it and goes to the generic catch block.

      In that catch-block the exception is handled by the handleWrite() method (RemoteFileProducer.java:83) and there it gets interesting.
      In handleWrite() check is performed if the Camel Base Service is in stopping() or stopped() state. If that's the case, the exception is only logged but not thrown. But isStopped() returns true, so my exception is thrown, but my application doesn't receive it, so it thinks that the file is transferred succesfully to the SFTP server, but it never arrives.




            davsclaus Claus Ibsen
            Jonas_a Jonas Audenaert
            0 Vote for this issue
            2 Start watching this issue