You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by NP-Hard <rm...@ironhawk.com> on 2010/02/23 15:52:01 UTC

Unable to delete file after processing on Windows

Hi,

I'm having a problem where Camel is unable to delete a file after processing
it in a route.
Problem occurs only on WinXP; on Linux it works fine.
My route looks something like this:

from( "file://foo?delete=true" ).process( proc1 ).recipientList( header(
"xyz" ).tokenize( "," ) );

Here, proc1.process() adds a header named "xyz" which is a comma separated
list of ActiveMQ URIs.

The route kicks in, processes the message but the last step of deleting the
input file fails with the
stack trace shown below. Changing the file disposition to rename makes no
difference and it fails
the same way. From the stack trace, it looks like a thread is trying to do
the delete while another
thread still has the file locked.

Any help is much appreciated, thanks.

=================================================================
     [java]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
delete file: GenericFile[five.txt]
     [java]     at
org.apache.camel.component.file.strategy.GenericFileDeletePro
cessStrategy.commit(GenericFileDeleteProcessStrategy.java:59)
     [java]     at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:125)
     [java]     at
org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:85)
     [java]     at
org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
     [java]     at
org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:131)
     [java]     at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:60)
     [java]     at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
     [java]     at
org.apache.camel.management.InstrumentationProcessor.process(nstrumentationProcessor.java:67)
     [java]     at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:201)
     [java]     at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:122)
     [java]     at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:95)
     [java]     at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:108)
     [java]     at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
     [java]     at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
     [java]     at
java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
     [java]     at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
     [java]     at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
     [java]     at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
     [java]     at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
     [java]     at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
     [java]     at java.lang.Thread.run(Thread.java:619)
========================================================================
-- 
View this message in context: http://old.nabble.com/Unable-to-delete-file-after-processing-on-Windows-tp27704464p27704464.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unable to delete file after processing on Windows

Posted by NP-Hard <rm...@ironhawk.com>.
Looks like Camel 2.2.0 has fixed the problem. Thanks !


NP-Hard wrote:
> 
> Thanks for the quick response. Here is some more info:
> 
> Camel version: 2.1.0
> ActiveMQ version: 5.3.0
> Java version: 1.6.0_18
> Container: None
> 
> I will try Camel 2.2 and report back.
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> Hi
>> 
>> Could you take a look at this wiki page
>> http://camel.apache.org/support.html
>> 
>> It has a few bullets that is good to mention when posting.
>> 
>> For example what Camel version. And did it work before?
>> eg Windows is especially a bit troublesome with its File system and
>> that is why we have special retries in Camel to cater for Windows not
>> being able to rename, delete or move files as fast as Linux or other
>> OS can do. I recon we have improved that in both 2.1 and 2.2.
>> 
>> You can enable DEBUG logging for org.apache.camel.util.FileUtil to see
>> attempts for that.
>> 
>> 
>> 
>> 
>> On Tue, Feb 23, 2010 at 3:52 PM, NP-Hard <rm...@ironhawk.com> wrote:
>>>
>>> Hi,
>>>
>>> I'm having a problem where Camel is unable to delete a file after
>>> processing
>>> it in a route.
>>> Problem occurs only on WinXP; on Linux it works fine.
>>> My route looks something like this:
>>>
>>> from( "file://foo?delete=true" ).process( proc1 ).recipientList( header(
>>> "xyz" ).tokenize( "," ) );
>>>
>>> Here, proc1.process() adds a header named "xyz" which is a comma
>>> separated
>>> list of ActiveMQ URIs.
>>>
>>> The route kicks in, processes the message but the last step of deleting
>>> the
>>> input file fails with the
>>> stack trace shown below. Changing the file disposition to rename makes
>>> no
>>> difference and it fails
>>> the same way. From the stack trace, it looks like a thread is trying to
>>> do
>>> the delete while another
>>> thread still has the file locked.
>>>
>>> Any help is much appreciated, thanks.
>>>
>>> =================================================================
>>>     [java]
>>> org.apache.camel.component.file.GenericFileOperationFailedException:
>>> Cannot
>>> delete file: GenericFile[five.txt]
>>>     [java]     at
>>> org.apache.camel.component.file.strategy.GenericFileDeletePro
>>> cessStrategy.commit(GenericFileDeleteProcessStrategy.java:59)
>>>     [java]     at
>>> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:125)
>>>     [java]     at
>>> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:85)
>>>     [java]     at
>>> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>>>     [java]     at
>>> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:131)
>>>     [java]     at
>>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:60)
>>>     [java]     at
>>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>>     [java]     at
>>> org.apache.camel.management.InstrumentationProcessor.process(nstrumentationProcessor.java:67)
>>>     [java]     at
>>> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:201)
>>>     [java]     at
>>> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:122)
>>>     [java]     at
>>> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:95)
>>>     [java]     at
>>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:108)
>>>     [java]     at
>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>>>     [java]     at
>>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>>>     [java]     at
>>> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>>>     [java]     at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>>>     [java]     at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>>>     [java]     at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>>>     [java]     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>     [java]     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>     [java]     at java.lang.Thread.run(Thread.java:619)
>>> ========================================================================
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Unable-to-delete-file-after-processing-on-Windows-tp27704464p27704464.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Unable-to-delete-file-after-processing-on-Windows-tp27704464p27705317.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unable to delete file after processing on Windows

Posted by NP-Hard <rm...@ironhawk.com>.
Thanks for the quick response. Here is some more info:

Camel version: 2.1.0
ActiveMQ version: 5.3.0
Java version: 1.6.0_18
Container: None

I will try Camel 2.2 and report back.


Claus Ibsen-2 wrote:
> 
> Hi
> 
> Could you take a look at this wiki page
> http://camel.apache.org/support.html
> 
> It has a few bullets that is good to mention when posting.
> 
> For example what Camel version. And did it work before?
> eg Windows is especially a bit troublesome with its File system and
> that is why we have special retries in Camel to cater for Windows not
> being able to rename, delete or move files as fast as Linux or other
> OS can do. I recon we have improved that in both 2.1 and 2.2.
> 
> You can enable DEBUG logging for org.apache.camel.util.FileUtil to see
> attempts for that.
> 
> 
> 
> 
> On Tue, Feb 23, 2010 at 3:52 PM, NP-Hard <rm...@ironhawk.com> wrote:
>>
>> Hi,
>>
>> I'm having a problem where Camel is unable to delete a file after
>> processing
>> it in a route.
>> Problem occurs only on WinXP; on Linux it works fine.
>> My route looks something like this:
>>
>> from( "file://foo?delete=true" ).process( proc1 ).recipientList( header(
>> "xyz" ).tokenize( "," ) );
>>
>> Here, proc1.process() adds a header named "xyz" which is a comma
>> separated
>> list of ActiveMQ URIs.
>>
>> The route kicks in, processes the message but the last step of deleting
>> the
>> input file fails with the
>> stack trace shown below. Changing the file disposition to rename makes no
>> difference and it fails
>> the same way. From the stack trace, it looks like a thread is trying to
>> do
>> the delete while another
>> thread still has the file locked.
>>
>> Any help is much appreciated, thanks.
>>
>> =================================================================
>>     [java]
>> org.apache.camel.component.file.GenericFileOperationFailedException:
>> Cannot
>> delete file: GenericFile[five.txt]
>>     [java]     at
>> org.apache.camel.component.file.strategy.GenericFileDeletePro
>> cessStrategy.commit(GenericFileDeleteProcessStrategy.java:59)
>>     [java]     at
>> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:125)
>>     [java]     at
>> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:85)
>>     [java]     at
>> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>>     [java]     at
>> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:131)
>>     [java]     at
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:60)
>>     [java]     at
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>>     [java]     at
>> org.apache.camel.management.InstrumentationProcessor.process(nstrumentationProcessor.java:67)
>>     [java]     at
>> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:201)
>>     [java]     at
>> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:122)
>>     [java]     at
>> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:95)
>>     [java]     at
>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:108)
>>     [java]     at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>>     [java]     at
>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>>     [java]     at
>> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>>     [java]     at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>>     [java]     at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>>     [java]     at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>>     [java]     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>     [java]     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>     [java]     at java.lang.Thread.run(Thread.java:619)
>> ========================================================================
>> --
>> View this message in context:
>> http://old.nabble.com/Unable-to-delete-file-after-processing-on-Windows-tp27704464p27704464.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/Unable-to-delete-file-after-processing-on-Windows-tp27704464p27704829.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unable to delete file after processing on Windows

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Could you take a look at this wiki page
http://camel.apache.org/support.html

It has a few bullets that is good to mention when posting.

For example what Camel version. And did it work before?
eg Windows is especially a bit troublesome with its File system and
that is why we have special retries in Camel to cater for Windows not
being able to rename, delete or move files as fast as Linux or other
OS can do. I recon we have improved that in both 2.1 and 2.2.

You can enable DEBUG logging for org.apache.camel.util.FileUtil to see
attempts for that.




On Tue, Feb 23, 2010 at 3:52 PM, NP-Hard <rm...@ironhawk.com> wrote:
>
> Hi,
>
> I'm having a problem where Camel is unable to delete a file after processing
> it in a route.
> Problem occurs only on WinXP; on Linux it works fine.
> My route looks something like this:
>
> from( "file://foo?delete=true" ).process( proc1 ).recipientList( header(
> "xyz" ).tokenize( "," ) );
>
> Here, proc1.process() adds a header named "xyz" which is a comma separated
> list of ActiveMQ URIs.
>
> The route kicks in, processes the message but the last step of deleting the
> input file fails with the
> stack trace shown below. Changing the file disposition to rename makes no
> difference and it fails
> the same way. From the stack trace, it looks like a thread is trying to do
> the delete while another
> thread still has the file locked.
>
> Any help is much appreciated, thanks.
>
> =================================================================
>     [java]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> delete file: GenericFile[five.txt]
>     [java]     at
> org.apache.camel.component.file.strategy.GenericFileDeletePro
> cessStrategy.commit(GenericFileDeleteProcessStrategy.java:59)
>     [java]     at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:125)
>     [java]     at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:85)
>     [java]     at
> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
>     [java]     at
> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:131)
>     [java]     at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:60)
>     [java]     at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>     [java]     at
> org.apache.camel.management.InstrumentationProcessor.process(nstrumentationProcessor.java:67)
>     [java]     at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:201)
>     [java]     at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:122)
>     [java]     at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:95)
>     [java]     at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:108)
>     [java]     at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>     [java]     at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>     [java]     at
> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>     [java]     at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>     [java]     at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>     [java]     at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>     [java]     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     [java]     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     [java]     at java.lang.Thread.run(Thread.java:619)
> ========================================================================
> --
> View this message in context: http://old.nabble.com/Unable-to-delete-file-after-processing-on-Windows-tp27704464p27704464.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus