You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/06/24 13:14:00 UTC

[jira] [Resolved] (CAMEL-16692) SFTP sometimes doesn't receive all files

     [ https://issues.apache.org/jira/browse/CAMEL-16692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-16692.
---------------------------------
    Resolution: Fixed

> SFTP sometimes doesn't receive all files 
> -----------------------------------------
>
>                 Key: CAMEL-16692
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16692
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 3.7.3
>         Environment: I'm reproducing this on my own computer and a SFTP server running on a Docker container locally.
>            Reporter: Jonas Audenaert
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.12.0
>
>
> I have following Camel route, created by a RoutingBuilder:
> {code:java}
> new org.apache.camel.builder.RouteBuilder() {
>   void configure() {
>     from("direct:myProgram")
>       .routeId("${params.profile}")
>       .to("sftp://${params.hostname}:${params.port}/${params.directory}?username=RAW(${params.username})&amp;password=RAW(${params.password})&amp;fileName=RAW(\${header.fileName})&amp;fileExist=Fail&amp;disconnect=true&amp;stepwise=false&amp;useUserKnownHostsFile=false&amp;serverAliveInterval=${params.serverAliveInterval}")
>   }
> }{code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)