Hide Forgot
Created attachment 834340 [details] Eclipse Maven project demonstrating the problem. Description of problem: When we use the ReteOO mode and a rule with a "before" condition, the rule execution is not triggered during the fireAllRules but with a little delay (timer ?). The problem doesn't happen in PHREAK mode. Version-Release number of selected component (if applicable): 6.0.0.CR5 The same problem happens with the 6.0.0.Final community version. How reproducible: Launch the JUnit test in the attached Eclipse project. Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
It seems like a timer is created for rules with temporal operator, even if the "search interval" is in the past. Class "org.drools.core.reteoo.builder.PatternBuilder" line 228: private void checkDelaying(final BuildContext context, final Constraint constraint) { if ( constraint instanceof IntervalProviderConstraint ) { // variable constraints always require a single declaration Declaration target = constraint.getRequiredDeclarations()[0]; if ( target.isPatternDeclaration() && target.getPattern().getObjectType().isEvent() ) { long uplimit = ((IntervalProviderConstraint) constraint).getInterval().getUpperBound(); // only makes sense to add the new timer if the uplimit is not infinity (Long.MAX_VALUE) if( uplimit < Long.MAX_VALUE ) { In the unit test, uplimit = -1 (condition = this before[1ms, 10s] sf1)
Fixed by https://github.com/droolsjbpm/drools/commit/9150b4ee98c5f3e8ad21e5fe3ecfbd8e8703101a
Verified with BRMS 6.0.1-redhat-2