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

Work on CAMEL-27083 started by shashank.
----------------------------------------
> camel-scheduler - a consumer that is stopped and started again never polls, 
> and its stop can shut down the thread pool of the other routes of the same 
> scheduler
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27083
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27083
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-scheduler
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>
> h3. What happens
> The consumers of a {{scheduler:name}} endpoint share a thread pool that the 
> component keeps per name with a reference count. 
> {{SchedulerEndpoint.onConsumerStart}} takes a reference only when the 
> consumer has no scheduler and no thread pool yet, but {{onConsumerStop}} 
> always releases one.
> # A consumer that is stopped and started again in place (JMX 
> {{ManagedConsumer}} stop/start, or a route policy that stops and starts the 
> consumer, such as the leader election policies of camel-zookeeper-master or 
> camel-hazelcast: "run the scheduled route on the leader only") still has the 
> pool and the scheduler of its first start. Its stop released the last 
> reference, so the component shut the pool down. The second start takes no 
> reference and schedules the poll on the pool that is shut down: with the 
> default thread pool profile (CallerRuns) the task is dropped without an 
> error. The route reports Started and never polls again.
> # With two routes on the same scheduler name, a stop and start of one route 
> and then a second stop releases the reference of the other route: the pool is 
> shut down under the other route, which stops polling too.
> # A consumer that has its own thread pool ({{scheduledExecutorService}}) or 
> its own scheduler never takes a reference, but its stop releases one, which 
> can shut down the pool of the other routes of that name.
> A route stop and start through the route controller creates a new consumer, 
> so it is not affected.
> h3. How to reproduce
> {{SchedulerConsumerRestartTest}} (camel-core): a route 
> {{from("scheduler://solo?initialDelay=0&delay=10")}}; after the first poll 
> {{ServiceHelper.stopService(consumer)}} and {{startService(consumer)}}: the 
> consumer's thread pool is shut down and no poll comes. Two more tests cover 
> the shared pool (stop/start/stop of route a, route b on the same name stops 
> polling) and a consumer with its own pool whose stop shuts down the pool of 
> the other route.
> h3. Fix
> The consumer remembers that it took a reference to the component's pool. Only 
> then its stop releases one, and its next start takes a new reference and 
> gives the new pool to the scheduler it created at its first start.
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to