[ 
https://issues.apache.org/jira/browse/CAMEL-27264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18147966#comment-18147966
 ] 

Adriano Machado commented on CAMEL-27264:
-----------------------------------------

Thanks for the reproducer, it made this tractable. I instrumented it with a 
tracking in\-progress repository, and every stuck file has the same history: 
its name is added while the directory is listed, the file is chosen for the 
poll, and then it is never removed on any thread.

_Root cause._ With {{bridgeErrorHandler=true}}, a read lock that fails \(here 
{{Pipe closed}}, see below\) sends a bridged error exchange to the 
{{pollEnrich}} receive call, and the file is not started. As no file was 
polled, the receive call polled again within the {{pollEnrich}} timeout and 
found the file. It could only return one exchange, so the file's exchange was 
parked on an internal queue that is never read. The completion that moves the 
file and clears its in\-progress entry therefore never ran. The same pattern 
shows up on 4.23.0 as exchanges returned one poll late, which is why a stuck 
file was sometimes moved to the archive much later. The fix stops polling again 
once an exchange was delivered to the receive call, and rolls back any file 
exchange it cannot return, so the file is polled again: 
[https://github.com/apache/camel/pull/30470|https://github.com/apache/camel/pull/30470]

_Why the sftp errors happen in your setup._ The {{timer}} consumer routes 
asynchronously by default, so it doesn't wait for the JMS reply. With a 10 s 
period and a 20 s {{requestTimeout}}, the {{pollEnrich}} of the next timer run 
overlaps the completion of the previous exchange on the JMS reply thread, and 
both use the endpoint's single sftp connection. That is the source of the 
{{Pipe closed}} and {{Cannot change directory to: ..}} errors. So the statement 
in the description that the runs never overlap doesn't hold.

_Workarounds until the fix is released:_ {{synchronous=true}} on the timer 
endpoint, so runs really don't overlap, or {{disconnect=false}} plus 
{{stepwise=false}} \(your "fixed" options\), which avoids the read\-lock 
failures that start it.

_Claude Code on behalf of Adriano Machado \(@ammachado\)_

_This was generated by an AI agent and may contain inaccuracies. Please verify 
before relying on it._



> camel-ftp - files polled with pollEnrich from sftp stay in the in-progress 
> repository and are skipped until restart when the enriched exchange completes 
> on another thread
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27264
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27264
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 4.10.9, 4.23.0
>            Reporter: Bruno Gonçalves
>            Assignee: Adriano Machado
>            Priority: Major
>         Attachments: sftp-pollenrich-stuck-inprogress-reproducer.tar.gz
>
>




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to