Bug in Cache-Konfiguration

Hi,

i found two bugs in the implementation of Openfire’s cache config:

1.
on line:

The PropertyEventListener checks for “.maxLifeTime” instead of “.maxLifetime”. Thats why lifetime settings will take effect only on restart.

2.
on line:

the cache interface says: getMaxCacheSize() returns long

on line:

the cache interface says that the same value is set as int

Also the documentation of the setMaxCacheSize says (https://github.com/igniterealtime/Openfire/blob/master/xmppserver/src/main/java/org/jivesoftware/util/cache/Cache.java#L77) that the value is in bytes

in the hazelcast plugin the value is used as megabyte (https://docs.hazelcast.org/docs/3.12/javadoc/ -> USED_HEAP_SIZE)
https://github.com/igniterealtime/openfire-hazelcast-plugin/blob/master/src/java/org/jivesoftware/openfire/plugin/util/cache/ClusteredCacheFactory.java#L246

That means that in non cluster environments the cache is in bytes and in cluster environments (with hazelcast) it is in megabytes.

my recommended solution would be that setMaxCacheSize should use long and in hazelcast plugin the value of byte should be converted to megabye.

I can create a pull-request for it

Best Regards

chp

1 Like

It seems that you are savvy with GitHub. You can suggest a PR to fix that.

@chp
thanks for the contribution! Please feel free to submit a PR on github. We welcome any improvements and/or bug fixes. @guus is currently our project lead, so feel free to reach out to him if you have any questions. He and others can usually be found in our chat… open_chat@conference.igniterealtime.org

Thanks again!

Thanks for reporting this! The fix related to the typo / different usage of camel-case will be fixed in Openfire 4.4.3.

The bug where an inconsistent data type is used to represent cache sizes will be fixed in Openfire 4.5.0.