Bug 981270

Summary: Rule including an interval timer with delay does not fire in fireUntilHalt() mode
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas David <tdavid>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.0Keywords: Regression
Target Milestone: ER4   
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:16:02 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 978979    

Description Marek Winkler 2013-07-04 10:53:19 UTC
When a rule defines an interval timer with non-zero delay, it does not fire. The rule uses accumulate and a time window and engine runs in fireUntilHalt() mode in a separate thread. I could not reproduce the problem when creating only a simple rule (without accumulate and time window).

It seems that using real-time or pseudo clock does not have effect on the issue. 

Please see the attached pull request for reproducer and more details. The test case is a bit artificial, but it passes with Beta3.

The rule looks as follows:

rule "Number of metadata events in the last 10 seconds"
timer (int: 1s 10s)
// timer (int: 0s 10s) - passes
when
    String( this == "events_inserted" )
    $clock: SessionClock()
    $count: Number() from accumulate( $event: MetadataEvent() over window:time(10s),  count( $event ) )
then
    System.out.println(new Date($clock.getCurrentTime()) + ": Events count: " + $count);
    countResult.add($count);
end


Version-Release number of selected component (if applicable):

Drools 6.0.0-SNAPSHOT
Drools 6.0.0.Beta4

This worked in 6.0.0.Beta3, marking as regression.


How reproducible:

Please run CepFireUntilHaltTimerTest from the pull request (to be attached soon).


Actual results:

The rule in the test does not fire.


Expected results:

The rule should fire making the test pass.

Comment 1 Marek Winkler 2013-07-04 10:55:38 UTC
Pull request with reproducer: https://github.com/droolsjbpm/drools/pull/220

Comment 2 Mario Fusco 2013-09-03 15:50:00 UTC
I fixed the rule scheduling when the interval timer is used. However the test needs a further sleep here

https://github.com/droolsjbpm/drools/commit/3cf78d69d#L0R120

to make sure that all the facts insertions are processed before to move the clock forward. Anyway this should be necessary only when using the PseudoClock.

This fix is NOT included in the CR3, but will be part of the CR4.

Comment 6 Tomas David 2013-10-14 13:15:53 UTC
Verified on BRMS 6.0.0.ER4.