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

Work on CAMEL-27085 started by shashank.
----------------------------------------
> camel-core - the inflight count of a route goes negative when it is removed 
> while an exchange is still in flight and added again with the same id, so its 
> next graceful stop does not wait
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27085
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27085
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>
> h3. What happens
> {{DefaultInflightRepository}} keeps a counter per route id. {{RouteService}} 
> adds it when the route is warmed up and removes it when the route is removed; 
> {{RouteInflightRepositoryAdvice}} increments and decrements the counter it 
> finds for the route id at that moment.
> When a route is stopped with a timeout that runs out (the stop is forced, 
> {{abortAfterTimeout=false}}) while an exchange is still in flight, and then 
> removed, its counter (1) is dropped. When a route with the same id is added 
> again (route reload, dev mode, a route template, {{removeRoute}} + 
> {{addRoutes}}), it gets a new counter at 0. When the old exchange ends, its 
> advice decrements the new counter to -1.
> From then on {{size(routeId)}} is one less than the real number of exchanges 
> of that route: the next graceful stop or reload of the route 
> ({{DefaultShutdownStrategy}} adds {{size(routeId)}} and the pending 
> exchanges) does not wait for one exchange that is in flight, which then fails 
> with a {{RouteStoppingException}}. {{ThrottlingInflightRoutePolicy}} with the 
> route scope lets one more exchange in, and JMX and the consoles show -1.
> h3. How to reproduce
> {{InflightRepositoryRouteRemovedWhileInflightTest}} (camel-core): an exchange 
> is held in route "slow", the route is stopped with a 100 ms timeout, removed 
> and added again, then the exchange is released: {{size("slow")}} is -1 
> (expected 0).
> h3. Fix
> {{removeRoute}} keeps the counter of a route that still has exchanges in 
> flight, marked as removed, until they are done (then it is dropped); a route 
> added again with the same id uses that counter, so the exchanges of the 
> removed route stay counted until they end and are not taken off the new route.
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to