shashank created CAMEL-26602:
--------------------------------
Summary: camel-core - suspendRoute on a stopped route marks it
Suspended, and a later startRoute or resumeRoute reports it Started without
starting its consumer
Key: CAMEL-26602
URL: https://issues.apache.org/jira/browse/CAMEL-26602
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
Assignee: shashank
Found with Fray (controlled concurrency testing for the JVM): a test that runs
{{stopRoute}}, {{suspendRoute}} and {{startRoute}} of the same seda route on
three threads failed in the order stop, suspend, start: the route reported
{{Started}}, but its consumer was stopped and not registered on the endpoint.
The order alone is enough, no race is needed.
{{AbstractCamelContext.suspendRoute}} suspends the route service without
checking that the route is started, and {{BaseService.suspend()}} moves any
status (also {{Stopped}}) to {{Suspended}}. So:
{code:java}
controller.stopRoute("foo"); // route and consumer stopped
controller.suspendRoute("foo"); // status is now Suspended
controller.startRoute("foo"); // startRouteService sees a suspended route
service and resumes it
// status is Started, but the consumer was never started: messages to the route
are not consumed
{code}
{{resumeRoute}} behaves the same, and a route with {{autoStartup=false}} that
is suspended before it was ever started ends the same way.
Ways to get there: the dev console, JMX ({{ManagedSuspendableRoute.suspend}}),
the control bus, a route policy ({{RoutePolicySupport.suspendRoute}}), and the
Camel CLI, whose {{suspend}} of all routes calls {{suspendRoute}} for every
route, also the stopped ones (then {{resume}} of all routes reports them all
Started). A route policy or an operator that stops a route while another one
suspends it also ends there.
The CamelContext suspend already only suspends the started routes
({{doSuspend}}: "we only want to suspend started routes").
Expected: suspending a route that is not started leaves it stopped, so a later
start or resume starts its consumer.
Suggested fix: {{suspendRoute}} does nothing (DEBUG log) when the route service
is not started.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)