Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.14.4, 3.14.6, 3.18.2
-
None
-
- occurred on Windows 11
- tried with Camel versions 3.14.4, 3.14.6 and 3.18.2
- route starts using scheduler://
-
Unknown
Description
Description
I have a route constructed approximately like this:
processDefinition .process { ex -> // setup repeating } .loopDoWhile(RepeatingPredicate()) .process { ex -> // prepare iteration } .process { ex -> // do work } .process { ex -> // finish iteration } .end() .process { ex -> // clean up repeating }
The route does some setup and then starts iterating - let's say 10 iterations when "the work" takes 10 seconds to complete.
Then, in the middle of processing (let's say during 5th iteration), I request Camel engine to shutdown with infinite timeout:
context.shutdownStrategy.timeout = Long.MAX_VALUE
context.stop()
But the Camel engine will shutdown immediately because it is not able to correctly detect current inflight requests.
Additional Info
More specifically, the ShutdownTask class tries to get inflight requests:
- InflightRepository returns 1 which is correct number
- but iterating over services returns negative number at the end
-> so the condition size > 0 is false which means no inflight requests
When going deeper, the LoopProcessor classes are the ones which return negative numbers of inflight requests.
Looks like the taskCount is not initialized because expression is null which means it's value is 0 but decremented several times
which will cause negative numbers to return.