[
https://issues.apache.org/jira/browse/CAMEL-27382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27382 started by shashank.
----------------------------------------
> camel-file - a done file with a fixed name kept for the files a poll left is
> deleted while the last file of that poll still routes: when the consumer
> stops, and with recursive=true when the next poll does not list a file in
> progress
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27382
> URL: https://issues.apache.org/jira/browse/CAMEL-27382
> Project: Camel
> Issue Type: Bug
> Components: camel-file
> Reporter: shashank
> Assignee: shashank
> Priority: Major
>
> h3. What happens
> With a done file with a fixed name ({{doneFileName=ready}}), a poll that
> leaves files of the directory for the next poll keeps the done file
> (CAMEL-25728), also when its last file completes on another thread
> (CAMEL-25960). Two cases still delete it while the last file of that poll is
> routing on another thread (seda, an async route):
> * *Stopping the consumer.* {{GenericFileConsumer.doStop}} calls
> {{GenericFileKeptDoneFiles.clear()}}, which empties the current set in place.
> The files of a poll refer to that same set (CAMEL-25960), so the last file,
> completing after the stop, deletes the done file. After a restart the files
> the poll left have no done file and are never consumed. Nothing is logged.
> * *A file in progress with recursive=true.* The listing skips a file in
> progress, so the next complete listing finds no file of its directory and
> deletes the kept done file as gone ({{startDoneFileBatch}}) while that file
> is still routing. When the file then fails, it stays without its done file
> for good, although the last file of a poll that fails should keep it.
> h3. How to reproduce
> # {{maxMessagesPerPoll=1}}, {{a.txt}}, {{b.txt}} and {{ready}}, the file
> route sends to {{seda:work}}. The poll takes one file and keeps {{ready}}.
> Stop the file route while the seda route still processes the file, then let
> it complete: {{ready}} is deleted, and after starting the route again the
> other file is never consumed.
> # {{recursive=true&maxMessagesPerPoll=1}}, {{d1/a.txt}} and {{d2/b.txt}} with
> their done files, an async route. The first poll takes one file (it routes on
> another thread) and keeps both done files. The next poll lists only the other
> directory and deletes the done file of the routing file. That file then fails
> and is never consumed again.
> Found with a TLA+ model.
> h3. Fix
> {{clear()}} starts a new set instead of emptying the current one, so the
> files of the last poll keep what their poll kept. The listing records the
> done files of the files it skips as in progress, and such a kept done file
> stays kept until a complete listing finds its directory without files in
> progress.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)