Skip to content

Commit f95c095

Browse files
committed
fixes #122: Avoid potential deadlock when loading plugin
If this plugin is being loaded when Openfire has already started, avoid initializing `initializeClustering` as part of the plugin initialization. The plugin initialization locks the plugin manager. `initializeClustering` needs to obtain resources from the plugin manager (which it can't get while it's locked). By making the `initializeClustering` method asynchronous, it no longer prevents the plugin initialization from completing, thus breaking the deadlock.
1 parent 91bf801 commit f95c095

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

changelog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ <h1>
4545
</h1>
4646
<p><b>5.5.0 Release 2</b> -- tbd</p>
4747
<ul>
48+
<li>[<a href='https://github.com/igniterealtime/openfire-hazelcast-plugin/issues/122'>Issue #122</a>] - Guard against deadlock on plugin initialization</li>
4849
<li>[<a href='https://github.com/igniterealtime/openfire-hazelcast-plugin/issues/117'>Issue #117</a>] - Fix cluster node page cannot open</li>
4950
<li>[<a href='https://github.com/igniterealtime/openfire-hazelcast-plugin/issues/112'>Issue #112</a>] - Support locks in SerializingCache</li>
5051
</ul>

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<description>${project.description}</description>
77
<author>Ignite Realtime</author>
88
<version>${project.version}</version>
9-
<date>2025-06-12</date>
9+
<date>2026-02-18</date>
1010
<minServerVersion>5.0.0</minServerVersion>
1111
<minJavaVersion>17</minJavaVersion>
1212
</plugin>

src/java/org/jivesoftware/openfire/plugin/HazelcastPlugin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2004-2009 Jive Software, 2022-2024 Ignite Realtime Foundation. All rights reserved.
2+
* Copyright (C) 2004-2009 Jive Software, 2022-2026 Ignite Realtime Foundation. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import java.nio.file.Files;
2222
import java.nio.file.Path;
2323
import java.nio.file.Paths;
24+
import java.util.concurrent.CompletableFuture;
2425

2526
import org.jivesoftware.openfire.XMPPServer;
2627
import org.jivesoftware.openfire.cluster.ClusterManager;
@@ -55,7 +56,7 @@ public void initializePlugin(final PluginManager manager, final File pluginDirec
5556
@Override
5657
public void pluginsMonitored() {
5758
manager.removePluginManagerListener(this);
58-
initializeClustering(pluginDirectory);
59+
CompletableFuture.runAsync(() -> initializeClustering(pluginDirectory)) ;
5960
}
6061
});
6162

0 commit comments

Comments
 (0)