Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1059372

Summary: NPE in a timer node when a left tuple get activated immediately and then rescheduled in the same node evaluation
Product: [Retired] JBoss BRMS Platform 6 Reporter: Mario Fusco <mfusco>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED CURRENTRELEASE QA Contact: Marek Winkler <mwinkler>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.0.0CC: etirelli, kverlaen, lpetrovi
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:58:23 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:

Description Mario Fusco 2014-01-29 18:00:57 UTC
When a left tuple get activated immediately and then rescheduled in the same evaluation loop fo a timer node the following Exception is thrown:

	at org.drools.core.phreak.PhreakTimerNode.doPropagateChildLeftTuple(
	at org.drools.core.phreak.PhreakTimerNode.doPropagateChildLeftTuples(
	at org.drools.core.phreak.PhreakTimerNode.doNode(
	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(
	at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(
	at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(
	at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(
	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(
	at org.drools.core.common.DefaultAgenda.fireNextItem(
	at org.drools.core.common.DefaultAgenda.fireAllRules(
	at org.drools.core.common.AbstractWorkingMemory.fireAllRules(
	at org.drools.core.common.AbstractWorkingMemory.fireAllRules(
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(
	at org.drools.compiler.integrationtests.Misc2Test.testCronFire(

The following test case reproduces the problem:

    public void testCronFire() throws InterruptedException {
        String drl = "package test.drools\n" +
                     "rule TestRule " +
                     "  timer (cron:* * * * * ?) " +
                     "when\n" +
                     "    String() " +
                     "    Integer() " +
                     "then\n" +

        KnowledgeBase kbase = loadKnowledgeBaseFromString(drl);
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        int repetitions = 10000;
        for (int j = 0; j < repetitions; j++ ) {
            ksession.insert( j );

        ksession.insert( "go" );

Comment 2 Mario Fusco 2014-01-29 18:46:20 UTC
Fixed by

Comment 3 Marek Winkler 2014-02-21 16:47:31 UTC
Verified that the fix is present in BRMS 6.0.1 ER1 and the corresponding test passes.