[ 
https://issues.apache.org/jira/browse/CAMEL-24924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-24924.
---------------------------------
    Fix Version/s: 4.23.0
       Resolution: Fixed

The fix is merged on main, so it is in Camel 4.23.0:
* 631fa9c68708 CAMEL-24924: camel-core - Failover load balancer without 
processors should complete the exchange
* ef653a377b8c CAMEL-24924: camel-core - Complete the exchange without 
processors like the other load balancers do

Resolving, as the ticket was not updated when the PR was merged.

_Claude Code on behalf of Claus Ibsen_

> Failover load balancer with no processors never completes the exchange, so 
> the caller hangs
> -------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24924
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24924
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: shashank
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> A route with a failover load balancer that has no outputs starts without any 
> error, but every exchange sent to it hangs:
> {code:java}
> from("direct:fo0").loadBalance().failover().end().setBody(constant("after"));
> from("direct:forr0").loadBalance().failover(-1, false, 
> true).end().setBody(constant("after"));
> {code}
> {{template.requestBody("direct:fo0", "x")}} never returns. Nothing is logged 
> and no exception is set on the exchange. The same route with {{roundRobin()}} 
> instead of {{failover()}} returns straight away and continues with the next 
> step.
> Cause: {{FailOverLoadBalancer.State.run()}} assumes there is at least one 
> processor. In the default mode it reaches "no more processors to try" and 
> calls {{ExchangeHelper.copyResults(exchange, copy)}} with {{copy == null}}, 
> which throws a {{NullPointerException}}. In round robin or sticky mode it 
> calls {{processors[0]}} on an empty array 
> ({{ArrayIndexOutOfBoundsException}}). Both happen inside a task on the 
> reactive executor, before {{callback.done}} is called, so the exchange is 
> never completed.
> Proposed fix: when there are no processors, complete the exchange straight 
> away ({{callback.done(true)}}), as {{QueueLoadBalancer}} and 
> {{TopicLoadBalancer}} already do.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to