shashank created CAMEL-27086:
--------------------------------
Summary: camel-zookeeper - a consumer that is stopped and started
again (route policy, JMX) never consumes again
Key: CAMEL-27086
URL: https://issues.apache.org/jira/browse/CAMEL-27086
Project: Camel
Issue Type: Bug
Components: camel-zookeeper
Reporter: shashank
Assignee: shashank
h3. What happens
{{ZooKeeperConsumer.doStop}} sets {{shuttingDown}} and nothing resets it. When
the same consumer is started again, {{initializeConsumer()}} sees the flag and
adds no operation: the new operations thread waits for ever on an empty queue,
and the route receives nothing more. There is no error.
This happens when the consumer is stopped and started in place: a route policy
that stops and starts the consumer of its route (the consumer is not
Suspendable, so {{ThrottlingInflightRoutePolicy}} and the circuit breaker
{{ThrottlingExceptionRoutePolicy}} stop and start it), or JMX
{{ManagedConsumer}} stop/start. A route stop and start through the route
controller creates a new consumer and is not affected.
Also, the stop does not interrupt the operations thread of the first start
({{ExecutorServiceManager.shutdown}}): it stays blocked on the queue or on the
watch of the closed connection, and after a start it can take the operations of
the new sequence.
h3. How to reproduce
{{ZooKeeperConsumerRestartTest}} (camel-zookeeper, embedded ZooKeeper server):
after the first data of the node, {{ServiceHelper.stopService(consumer)}} and
{{startService(consumer)}}. The consumer never reads the node again (the test
waits 20 seconds).
h3. Fix
The start clears {{shuttingDown}}. The stop ends the operations thread of its
start (marked stopped and interrupted, unless the stop runs on that thread),
which then does not add a copy of its operation or start the sequence again.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)