You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Guillaume Nodet (Jira)" <ji...@apache.org> on 2026/10/19 09:34:00 UTC
[jira] [Assigned] (CAMEL-25778) camel-file - the consumer can route a file twice when the exchange is completed on another thread
[ https://issues.apache.org/jira/browse/CAMEL-25778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet reassigned CAMEL-25778:
---------------------------------------
Assignee: Guillaume Nodet
> camel-file - the consumer can route a file twice when the exchange is completed on another thread
> -------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25778
> URL: https://issues.apache.org/jira/browse/CAMEL-25778
> Project: Camel
> Issue Type: Bug
> Components: camel-file
> Reporter: Urmila Unni
> Assignee: Guillaume Nodet
> Priority: Major
>
> When a route hands the exchange off to another thread after a file consumer (an async delay, threads, seda or disruptor), the exchange is committed on that thread while the file consumer keeps polling. A poll can then route a file a second time after it was already moved:
> 1. the poll lists the directory while the file is still there,
> 2. another thread commits the exchange: GenericFileOnCompletion moves the file (for example to .camel) and then removes it from the in-progress repository,
> 3. the poll reaches the in-progress check in GenericFileConsumer.isValidFile for that file after the removal, so the check passes and the already-moved file is routed again. Its commit then fails with "Cannot rename file".
> Found while fixing CAMEL-25647 (FileDisruptorShutdownCompleteAllTasksTest: a file route with an async delay(1000) to a disruptor endpoint). Log of one failing run, for b.txt:
> {noformat}
> 12.619 [disruptor://foo] Done processing file: GenericFile[b.txt]
> 12.637 [disruptor://foo] Renaming file: GenericFile[b.txt] to: GenericFile[.camel\b.txt]
> 12.663 [arget/disruptor] Took 41ms to poll: target\disruptor
> 12.663 [arget/disruptor] Total 1 files to consume
> 12.667 [arget/disruptor] About to process file: GenericFile[b.txt]
> 13.685 [disruptor://foo] WARN Error during commit ... Cannot rename file: GenericFile[b.txt] to: GenericFile[.camel\b.txt]
> {noformat}
> The poll that picked up b.txt the second time took 41 ms, so it started at about 12.622, before the rename at 12.637.
> Possible fix, suggested in the review of https://github.com/apache/camel/pull/28039: check that the file still exists after it was added to the in-progress repository.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)