shashank created CAMEL-27438:
--------------------------------

             Summary: camel-core - ThrottlingExceptionRoutePolicy: when 
resuming the consumer fails in the half open check, the circuit stays open for 
good
                 Key: CAMEL-27438
                 URL: https://issues.apache.org/jira/browse/CAMEL-27438
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: shashank
            Assignee: shashank


h3. What happens

The half open check of {{ThrottlingExceptionRoutePolicy}} runs once per open 
period, on the scheduler of the policy (CAMEL-26104). When it half opens the 
circuit and resuming the consumer throws, the exception goes to the exception 
handler of the policy and the circuit stays open. But the check that just ran 
was the only one scheduled, and the consumer is suspended, so no exchange 
completes and checks the circuit either. Nothing ever checks it again: the 
circuit stays open and the route takes no message until it is restarted, 
although the docs say the circuit closes by itself.

The same happens when a ready {{halfOpenHandler}} closes the circuit and the 
resume throws, and when a {{halfOpenHandler}} that is not ready keeps the 
circuit open and suspending the consumer again throws. When the handler itself 
throws, the policy already checks again after {{halfOpenAfter}}, and 
CAMEL-26313 made the check schedule the next one when {{halfOpenAfter}} was 
raised. So a retry is the intended behaviour.

h3. How to reproduce

A policy with {{halfOpenAfter=100}} whose first {{resumeOrStartConsumer}} 
throws (the later ones work): after the circuit opens, the first check fails to 
resume the consumer, and no other check runs; the circuit is still open seconds 
later.

Found with a TLA+ model of the policy and its half open timer: with one failing 
resume, "an open circuit always has a half open check pending" is violated, and 
so is "the circuit does not stay open for ever".

h3. Fix

When a half open check ends with the circuit still open and no other check 
scheduled, schedule the next one after {{halfOpenAfter}} and log a WARN.

A consumer whose own resume failed may be left in the failed state, which 
resuming does not bring back; that needs the route restarted, as today.

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to