gnodet opened a new pull request, #30747:
URL: https://github.com/apache/camel/pull/30747

   ## Summary
   
   Fix `Sqs2Consumer.TimeoutExtender.run()` to catch all non-fatal exceptions, 
not only `SdkException`, so that the visibility timeout extender keeps running 
after a transient failure that is not an AWS SDK exception.
   
   ## Root Cause
   
   `TimeoutExtender.run()` is submitted to a `ScheduledExecutorService` via 
`scheduleAtFixedRate`. Per the `ScheduledExecutorService` contract, any 
uncaught exception from a `scheduleAtFixedRate` task permanently cancels the 
task with no log entry.
   
   The catch block in `run()` only caught `SdkException`. Any other 
`RuntimeException` (e.g. an `IllegalStateException` from an AWS execution 
interceptor, or a `NullPointerException`) or non-fatal `Error` escaped the 
method uncaught, silently killing the extender for all subsequent messages 
received by that consumer. SQS then re-delivered in-flight messages while the 
route still processed them.
   
   ## Fix
   
   Widen the catch from `SdkException` to `Exception` (covering all checked and 
unchecked exceptions), and add a separate `Error` catch that re-throws 
`VirtualMachineError` (fatal JVM errors: `OutOfMemoryError`, 
`StackOverflowError`, etc.) but logs and continues for all other `Error`s. The 
`logException` helper is updated to accept `Throwable` accordingly.
   
   The log message is also updated to no longer say "Will not attempt to extend 
visibility further" — the extender does keep running after the fix.
   
   ## Tests
   
   `SqsConsumerExtendMessageVisibilityNonSdkExceptionTest`: the mock 
`changeMessageVisibilityBatch` throws `IllegalStateException` on the first 
call; the test asserts that subsequent calls still happen (extender kept 
alive), and that the message is routed successfully. This test fails on the 
unfixed code (the extender is killed after the first exception, the latch never 
reaches 2) and passes with the fix.
   
   Fixes CAMEL-27473
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to