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

Work on CAMEL-27337 started by shashank.
----------------------------------------
> camel-jgroups-raft - the cluster views of the namespaces of a node do not 
> share the RaftHandle correctly: a late namespace never leads, stopping one 
> disconnects the others, and without a configured handle a second namespace 
> cannot start
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27337
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27337
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jgroups
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>
> h3. What happens
> {{JGroupsRaftClusterService}} gives one view per namespace (master and 
> clustered routes). A node is one Raft member (one raft id), so the views have 
> to share one {{RaftHandle}}, but each view manages the handle as if it were 
> its own:
> # A view learns its role only from role change callbacks. Its {{doStart}} 
> registers the listener and calls {{channel().connect}}, which does nothing 
> once the shared channel is connected, and never reads the current role. A 
> namespace whose view starts after the node was elected (a master route added 
> or restarted at runtime, or started lazily) keeps {{isMaster=false}}, and as 
> the other nodes are followers no node runs it until the Raft leader changes.
> # When the last user of a namespace releases its view, {{doStop}} disconnects 
> the shared channel and closes its log. jgroups-raft steps the node down, so 
> every other namespace loses the leadership and the node stays out of Raft; in 
> a 2 node cluster no namespace has a leader anywhere.
> # Without a configured {{raftHandle}} (the default), each view creates its 
> own {{JChannel}} and {{RaftHandle}} with the service's single raft id. 
> {{NO_DUPES}} rejects the second member, and after 10 tries of 5 s the second 
> route fails to start: {{SecurityException: join of A rejected as it would 
> create a view with duplicate members}}.
> h3. How to reproduce
> One node ({{raft.xml}} of the module's tests), two master routes 
> {{master:ns1:timer:...}} and {{master:ns2:timer:...}}: add the second route 
> after the node became leader (it never runs), or stop the first route (the 
> second one stops running), or use no {{raftHandle}} on the service (the 
> CamelContext does not start).
> Found with a TLA+ model of the cluster views.
> h3. Fix
> The service owns the node's handle: the configured one or one it creates, 
> connected when the first view starts and disconnected when the last view 
> stops (reference counted, as {{JGroupsRaftEndpoint}} and the component do for 
> their handles, CAMEL-25883). One role listener on the handle forwards the 
> role changes to the views; a view reads the current role after it connected, 
> and ignores the role changes still notified to it once it is stopped.
> _Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to