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

Guillaume Nodet commented on CAMEL-27473:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Code analysis confirms the bug in Sqs2Consumer.TimeoutExtender.run(): the catch 
block at line 582 only catches SdkException. Per ScheduledExecutorService 
contract, any uncaught exception from scheduleAtFixedRate permanently cancels 
the task with no log. A non-SdkException (NullPointerException, 
RuntimeException, or Error) thrown from changeMessageVisibilityBatch() will 
silently kill the visibility extender for all subsequent messages. Fix: widen 
catch from SdkException to Exception (and add separate Error handling).

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-aws2-sqs - extendMessageVisibility: the visibility is no longer 
> extended after one failure that is not an SdkException
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27473
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27473
>             Project: Camel
>          Issue Type: Sub-task
>          Components: camel-aws2-sqs
>            Reporter: Federico Mariani
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> With {{extendMessageVisibility=true}}, {{Sqs2Consumer}} extends the 
> visibility of the messages in flight from a {{TimeoutExtender}} task 
> ({{scheduleAtFixedRate}}), whose {{run()}} catches only {{SdkException}}. Any 
> other {{RuntimeException}} (such as one of an {{ExecutionInterceptor}} of the 
> client), or an Error, ends the task for good. The visibility of the messages 
> in flight, and of all the messages the consumer receives after that, is no 
> longer extended, so SQS makes them visible again and delivers them a second 
> time while the route still processes them. Nothing is logged.
> Reproduced on main with an {{AmazonSQSClientMock}} whose first 
> {{changeMessageVisibilityBatch}} throws an {{IllegalStateException}}, 
> {{visibilityTimeout=2}}, and a route that holds the message for 6 seconds:
> {noformat}
> changeMessageVisibilityBatch calls in 6 seconds: 1 (the extender runs every 
> second)
> {noformat}
> Suggested fix: catch {{Exception}}, and an Error that is not a 
> {{VirtualMachineError}}, inside {{run()}}, log it, and go on at the next run.
> _Claude Code on behalf of Croway_



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

Reply via email to