You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/08/31 19:38:00 UTC

[jira] [Updated] (CAMEL-24545) Camel Shutdown Locked State With ZookeeprCluster Service

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

Claus Ibsen updated CAMEL-24545:
--------------------------------
    Fix Version/s: 4.23.0

> Camel Shutdown Locked State With ZookeeprCluster Service
> --------------------------------------------------------
>
>                 Key: CAMEL-24545
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24545
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-zookeeper, camel-zookeeper-master
>    Affects Versions: 4.22.1, 4.18.5
>         Environment: One ZK instance and one camel instance running ZooKeeperClusterService you need to use the main branch or any fix branch as this PR didn't span into a released version. 
>            Reporter: mustafa kamal
>            Priority: Major
>              Labels: Deadlock
>             Fix For: 4.23.0
>
>         Attachments: dump.txt
>
>
>  During shutdown, Camel's ClusteredRoutePolicy.onRemove and the Curator leader selector thread both run concurrently  because some routes keep the shutdown window open long enough. These two threads acquire the same two locks in opposite order, causing a classic deadlock that permanently hangs the JVM.
> You can check the attached Thread Dump to see the technical level of the issue more.
>  
> Possible fix is to surround `fireLeadershipChangedEvent((CamelClusterMember) null);` line 154 in `ZooKeeperClusterView` class, with `if (!isStoppingOrStopped())` that will solve the dead lock issue 
> Another issue it solved the unnecessary firing of the Leadership Change event because on stopping/shutting down the view all the registered listeners will be removed so any reaction they need to do should be before stopping the view because stopping the view is not as the same as Losing the Leadership Lock so that's more of an enhancement than breaking functionality. 
>  
> To reproduce the issue run the application wait until it's the Leader by acquiring the lock in ZK then shutting down the application, not all routes will produce the issue some routes have a long enough shutdown windows that allows the Dead Lock to happen 
>  
> This issue is related to the PR [https://github.com/apache/camel/pull/25611] for ticket https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-24457



--
This message was sent by Atlassian Jira
(v8.20.10#820010)