igniterealtime / openfire-hazelcast-plugin

Adds support for running multiple redundant Openfire servers together in a cluster
10 stars 13 forks source link

Incorrect cluster state reported in secondary nodes of cluster #58

Closed devillaccc closed 3 years ago

devillaccc commented 3 years ago

Steup: Two nodes in cluster, Openfire 4.2.0, plugins: custom plugin 'aplugin', hazelcast, other standard OF

  1. Start Openfire in one node
  2. A plugin named 'aplugin' determines cluster status while its initializing using - ClusterManager.isClusteringAvailable() && ClusterManager.isSeniorClusterMember() - Which returns true
  3. After Primary node initialized completely - Openfire service on Secondary node started
  4. During 'aplugin' initialization as in Step#2 in secondary node, the condition returns true. Expecting the condition to evaluate to false.
Fishbowler commented 3 years ago

Given other logging on the server, is the cluster status "settled" at the point that the plugin makes this determination?

By which I mean, is the Hazelcast plugin also initialising at the same point, and so it's too early to know if this cluster node will or will not be the senior member?

As an aside, have you tested this with a modern version of Openfire? There's been a not insignificant amount of work in the intervening years as regards clustering.

GregDThomas commented 3 years ago

You're using the wrong API. You need ClusterManager.isSeniorClusterMemberOrNotClustered() which has been available for over 2 years since Openfire 4.3.0.