Skip to content

fixes #122: Avoid potential deadlock when loading plugin#123

Open
guusdk wants to merge 1 commit intoigniterealtime:mainfrom
guusdk:122_deadlock-on-load
Open

fixes #122: Avoid potential deadlock when loading plugin#123
guusdk wants to merge 1 commit intoigniterealtime:mainfrom
guusdk:122_deadlock-on-load

Conversation

@guusdk
Copy link
Member

@guusdk guusdk commented Feb 18, 2026

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.

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.
@guusdk guusdk force-pushed the 122_deadlock-on-load branch from 6e2eec2 to f95c095 Compare February 18, 2026 17:53
@guusdk guusdk changed the title 122: Avoid potential deadlock when loading plugin fixes #122: Avoid potential deadlock when loading plugin Feb 18, 2026
public void pluginsMonitored() {
manager.removePluginManagerListener(this);
initializeClustering(pluginDirectory);
CompletableFuture.runAsync(() -> initializeClustering(pluginDirectory)) ;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is already in an async listener, I assume if this threw before and threw now, the effect would be the same? Initialize would still complete, etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants