shashank created CAMEL-26870:
--------------------------------

             Summary: camel-zookeeper-master - a stopped master consumer stays 
a connection state listener of the shared CuratorFramework
                 Key: CAMEL-26870
                 URL: https://issues.apache.org/jira/browse/CAMEL-26870
             Project: Camel
          Issue Type: Bug
          Components: camel-zookeeper-master
            Reporter: shashank
            Assignee: shashank


Each start of a {{MasterConsumer}} creates a {{ZookeeperGroupListenerSupport}}, 
which registers itself as a connection state listener on the 
{{CuratorFramework}} it uses ({{ZookeeperGroupSupport.setCurator}}, or the 
lookup of the {{curator}} bean of the registry in {{doStart}}): the curator of 
the component or the registry bean, which the consumers share. 
{{ZookeeperGroupSupport.doStop}} closes the group but never removes the 
listener, so the shared client keeps one listener for every start of every 
consumer (a route restart, a route reload), and each holds its consumer, 
endpoint and closed group for as long as the client lives.

The {{MasterRoutePolicy}} has the same gap; CAMEL-26802 (apache/camel#29583) 
removes its listener in the policy itself. Its review pointed out the sibling 
in {{MasterConsumer}}.

Expected: a group listener that stops removes itself from the client it 
registered on.

Possible fix: {{ZookeeperGroupSupport}} remembers the client it registered on 
and removes itself in {{doStop}} (and registers again when started again), 
which covers the consumer, the route policy and the component.

Found in the review of CAMEL-26802, from reading the code; confirmed with a 
test (a {{curator}} bean in the registry, the route stopped and started again).

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to