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

Claus Ibsen reassigned CAMEL-25500:
-----------------------------------

    Assignee: Claus Ibsen

> camel-core - removeAllRoutes / stopAllRoutes stop routes one by one, so a 
> route still sending to a direct route is cut off instead of drained
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25500
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25500
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.23.0
>
>
> AbstractCamelContext.removeAllRoutes() and stopAllRoutes() stop the routes 
> one at a time (stopRoute per route, in reverse startup order), each as its 
> own graceful shutdown. The ShutdownStrategy keeps a downstream route running 
> until the upstream routes have drained (DirectConsumer.deferShutdown returns 
> true), but only within one batch of routes. Stopped one by one, the 
> downstream route is stopped as soon as its own inflight count is 0, and an 
> upstream route that still has work to send to it (a split, a loop) blocks on 
> the direct endpoint until the shutdown timeout forces it, and the exchange is 
> cut off.
> This is the route reload in dev mode: RouteWatcherReloadStrategy calls 
> removeAllRoutes() on every reload.
> Reproduce: seda:start -> split(body()).delay(300).to(direct:shipment); 
> direct:shipment -> mock:shipped. Send a list of 4, wait for the first to 
> arrive, call context.getRouteController().removeAllRoutes() with a 3 s 
> shutdown timeout.
> * Today: takes 3011 ms (the full timeout), 1 of 4 delivered, 3 cut off with 
> RejectedExecutionException.
> * Stopping the same routes as one batch 
> (getShutdownStrategy().shutdown(context, allRoutes, ...)), as a CamelContext 
> stop does: 1011 ms, 4 of 4 delivered.
> Also, one by one each stuck route can use the full timeout, so N routes can 
> take N x timeout.
> Fix: stop all routes as one batch through the ShutdownStrategy, as 
> doShutdownRouteGroup already does for a route group, then stop the route 
> services.
> Found in the local-model benchmark (route-aggregator example), together with 
> CAMEL-25484.



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

Reply via email to