Bug 1039579

Summary: Problem with ReteOO and "before" in CEP mode.
Product: [Retired] JBoss BRMS Platform 6 Reporter: Richard Bourner <rbourner>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas Schlosser <tschloss>
Severity: high Docs Contact:
Priority: medium    
Version: 6.0.0CC: rbourner
Target Milestone: ER6   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:18:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Eclipse Maven project demonstrating the problem. none

Description Richard Bourner 2013-12-09 14:03:13 UTC
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:

Comment 2 Richard Bourner 2013-12-09 14:13:41 UTC
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)

Comment 4 Tomas Schlosser 2014-01-06 10:09:11 UTC
Verified with BRMS 6.0.1-redhat-2