igniterealtime / openfire-hazelcast-plugin

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

Late cluster cache swap after joining new cluster #67

Open evdherberg opened 2 years ago

evdherberg commented 2 years ago

In #65 we observed that, at the moment the memberAdded(final MembershipEvent event) is received in the ClusterListener, the CacheFactory is still using the DefaultLocalCacheStrategy instead of the strategy from the plugin. This resulted in a silent ignore of the cluster task we introduced in that method. Because that's what the default cache strategy does with cluster tasks.

The problem was resolved in https://github.com/igniterealtime/openfire-hazelcast-plugin/pull/66/commits/b454bff2edf77fe5ab9602f8ce41fdce2cd9fbac by introducing a short wait, until we observe the CacheFactory actually using the strategy provided by this plugin. In local testing, this always happened within the first 200ms of waiting.

Probably it is wise to check whether there are any other event handlers that rely on the cache being properly swapped already. Note that the joinedCluster() events are evoked from the memberAdded handler in the plugin, so those could possibly be vulnerable in this respect.

guusdk commented 2 years ago

Those joinedCluster() invocations are no longer vulnerable with the fix in https://github.com/igniterealtime/openfire-hazelcast-plugin/commit/b454bff2edf77fe5ab9602f8ce41fdce2cd9fbac in place, correct?

If that's the case, then the only thing to do is to verify that this plugin has no other event listeners that could trigger a 'premature' task execution?