Modification of properties even outside "modify" block causes re-evaluation loop by property reactivity.
Issue
Our rules like (*1) and (*2) below, which run successfully on RHDM 7.10.0, cause infinite re-evaluations on after 7.10.1 or later releases. Specifically, Rule 2 causes infinite re-evaluation loop even though value1 property is modified outside modify block in then-clause of Rule 2.
(*1) Example rule
dialect "mvel"
rule "Rule 1"
when
$fact : Fact( value1 == null,
value2 == null )
then
System.out.println("***** Action of " + drools.getRule().getName() + ": $fact = " + $fact);
modify($fact) {
value1 = "1"
}
end
rule "Rule 2"
when
$fact : Fact( value1 == "1" )
then
System.out.println("***** Action of " + drools.getRule().getName() + ": $fact = " + $fact);
$fact.value1 = "1";
modify($fact) {
value2 = "done"
}
end
// value1 and value2 are both String-type properties of Fact object.
(*2) Java code
KieServices kServices = KieServices.Factory.get();
KieContainer kContainer = kServices.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession();
Fact fact1 = new Fact();
fact1.setId("fact1");
fact1.setValue1(null);
fact1.setValue2(null);
kSession.insert(fact1);
kSession.fireAllRules();
Environment
- Red Hat Decision Manager (RHDM)
- 7.10.1 - 7.13.x
- Red Hat Process Automation Manager (RHPAM)
- 7.10.1 - 7.13.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.