shashank created CAMEL-24922:
--------------------------------
Summary: Failover load balancer in sticky mode without round robin
never tries the endpoints before the last known good one
Key: CAMEL-24922
URL: https://issues.apache.org/jira/browse/CAMEL-24922
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
With loadBalance().failover(-1, false, false, true) (sticky, no round robin),
each exchange starts at the last known good endpoint and only moves forward
through the list. When it reaches the end, the exchange fails. The endpoints
before the last known good one are never tried, and the last known good index
isn't changed, so every later exchange fails the same way, even though other
endpoints are up and maximumFailoverAttempts is -1.
Example with endpoints a, b, c:
# a and b are down, c is up: the exchange succeeds on c, which becomes the last
known good endpoint.
# a and b come back up and c goes down: every exchange now tries only c and
fails.
The sticky failover requirement (CAMEL-3910) says "If endpoint2 were then to
fail, messages start being sent to endpoint1 again", and FailoverStickyTest
notes that this configuration "will keep retrying as its configured to never
exhaust". With roundRobin=true the same scenario recovers.
Cause: FailOverLoadBalancer.State starts at lastGoodIndex in sticky mode, and
when index >= processors.length it only wraps around if round robin is enabled.
Proposed fix: in sticky mode without round robin, continue from the first
endpoint when the end of the list is reached, and stop once all endpoints have
been tried once for the exchange.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)