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

Claus Ibsen resolved CAMEL-3134.
--------------------------------

    Fix Version/s: 2.5.0
       Resolution: Fixed

trunk: 998603.

Thanks for reporting. I have committed a fix which closes the stream and 
deletes the temp file.
Can you test it out on your system?

You can use a PollingConsumerPollStrategy as the logic to retry in case the 
poll failed.

> FTP poller seems to hang if it has connection issues in the middle of 
> downloading a file
> ----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3134
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3134
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-ftp
>    Affects Versions: 2.4.0
>         Environment: JDK 1.6 on windows and linux
>            Reporter: Tim Cull
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.5.0
>
>
> When connecting to a somewhat unstable FTP server, I occasionally have issues 
> where the FTP poller dies (for all practical purposes because it stops 
> polling, not sure what state it's actually in) if it encounters a connection 
> issue in the middle of downloading a file.  At the bottom of this issue is an 
> example stack trace from when this issue occurs.
> I believe the exception is caused by a network-level issue with the 
> connection to the remote FTP server.  This belief is based on the comment by 
> Guy Rouillier in this issue:  
> https://issues.apache.org/jira/browse/NET-160
> The best fix is probably to put some retry logic in 
> org.apache.camel.component.file.remote.FtpOperations.retrieveFileToFileInLocalWorkDirectory()
>  such that if this line throws and exception:
> result = client.retrieveFile(onlyName, os);
> then it closes the local file output stream, deletes the local file (if 
> there's anything there), disconnects from the FTP server, reconnects, and 
> then tries the download again.
> [17/09/10 08:24:20:020 EDT] ERROR remote.FtpConsumer: Caused by: 
> [org.apache.camel.component.file.GenericFileOperationFailedException - File 
> operation failed
> : 125 Data connection open; transfer starting.
>  IOException caught while copying.. Code: 125]
> org.apache.camel.component.file.GenericFileOperationFailedException: File 
> operation failed: 125 Data connection open; transfer starting.
>  IOException caught while copying.. Code: 125
>         at 
> org.apache.camel.component.file.remote.FtpOperations.retrieveFileToFileInLocalWorkDirectory(FtpOperations.java:310)
>         at 
> org.apache.camel.component.file.remote.FtpOperations.retrieveFile(FtpOperations.java:235)
>         at 
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:254)
>         at 
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:137)
>         at 
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:103)
>         at 
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:98)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>         at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown 
> Source)
>         at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
>  Source)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
>  Source)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
>  Source)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
> Source)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>         at java.lang.Thread.run(Unknown Source)
> Caused by: org.apache.commons.net.io.CopyStreamException: IOException caught 
> while copying.
>         at org.apache.commons.net.io.Util.copyStream(Util.java:129)
>         at 
> org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1286)
>         at 
> org.apache.camel.component.file.remote.FtpOperations.retrieveFileToFileInLocalWorkDirectory(FtpOperations.java:307)
>         ... 14 more
> [

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to