Adriano Machado created CAMEL-28070:
---------------------------------------

             Summary: camel-resilience4j - a narrowed record predicate makes an 
open-circuit rejection look like a successful execution, so the fallback does 
not run
                 Key: CAMEL-28070
                 URL: https://issues.apache.org/jira/browse/CAMEL-28070
             Project: Camel
          Issue Type: Bug
            Reporter: Adriano Machado


In ResilienceProcessor \(around line 1238\), the check of the record exception 
predicate runs before the branches that handle
CallNotPermittedException, BulkheadFullException and TimeoutException.

When the record predicate is narrowed \(the EIP recordExceptions option, or the 
record exceptions of the config option since CAMEL\-27989\), these resilience4j 
exceptions are not matched by the predicate. The exchange is then treated as a 
successful execution: the exception is cleared and the fallback is skipped.

Result: with recordExceptions\(IOException.class\), once the circuit is open 
the call is rejected with CallNotPermittedException, but the route continues as 
if it had succeeded and onFallback is not run.

Steps to reproduce:
1. Route with 
circuitBreaker\(\).resilience4jConfiguration\(\).recordExceptions\(IOException.class\)
 and an onFallback.
2. Make the route fail with IOException until the circuit opens 
\(minimumNumberOfCalls / failureRateThreshold\).
3. Send another message: CallNotPermittedException is thrown by resilience4j, 
the record predicate does not match it, the exchange is handled as successful 
and the fallback does not run.

Expected: CallNotPermittedException, BulkheadFullException and TimeoutException 
always count as failures for the fallback decision, whatever the record 
predicate says \(the exceptions of resilience4j itself are not application 
exceptions to record or not\).

Found while reviewing the PR of CAMEL\-27989 \(reported by davsclaus\). Not 
fixed there, as it already happens with the EIP recordExceptions option today.



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

Reply via email to