j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.88k stars 1.05k forks source link

ConcurrentModificationException under load #402

Open ab0159w opened 1 year ago

ab0159w commented 1 year ago

Hi,

We are seeing this error under load.

java.util.ConcurrentModificationException: null
    at java.base/java.util.TreeMap$PrivateEntryIterator.nextEntry(Unknown Source)
    at java.base/java.util.TreeMap$KeyIterator.next(Unknown Source)
    at org.jeasy.rules.core.RuleProxy.appendActionMethodsNames(RuleProxy.java:353)
    at org.jeasy.rules.core.RuleProxy.getRuleDescription(RuleProxy.java:334)
    at org.jeasy.rules.core.RuleProxy.invoke(RuleProxy.java:101)
    at com.sun.proxy.$Proxy218.getDescription(Unknown Source)
    at org.jeasy.rules.core.DefaultRulesEngine.log(DefaultRulesEngine.java:146)
    at org.jeasy.rules.core.DefaultRulesEngine.doFire(DefaultRulesEngine.java:80)
    at org.jeasy.rules.core.DefaultRulesEngine.fire(DefaultRulesEngine.java:70)

In RuleProxy line 279

    private Set<ActionMethodOrderBean> getActionMethodBeans() {
        if (this.actionMethods == null) {
            this.actionMethods = new TreeSet<>();

Consider using ConcurrentSkipListSet.

dvgaba commented 1 year ago

Could you please share a sample test/git repo to re-produce this