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 - NPE in a timer node when a left tuple get activated immediately and then rescheduled in the same node evaluation
Summary: NPE in a timer node when a left tuple get activated immediately and then resc...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ER1
: 6.0.1
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-29 18:00 UTC by Mario Fusco
Modified: 2014-08-06 19:58 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-06 19:58:23 UTC
Type: Bug


Attachments (Terms of Use)

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:

java.lang.NullPointerException
	at org.drools.core.phreak.PhreakTimerNode.doPropagateChildLeftTuple(PhreakTimerNode.java:358)
	at org.drools.core.phreak.PhreakTimerNode.doPropagateChildLeftTuples(PhreakTimerNode.java:326)
	at org.drools.core.phreak.PhreakTimerNode.doNode(PhreakTimerNode.java:72)
	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:357)
	at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
	at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
	at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:200)
	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:67)
	at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:935)
	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1200)
	at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:958)
	at org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:932)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:232)
	at org.drools.compiler.integrationtests.Misc2Test.testCronFire(Misc2Test.java:5192)

The following test case reproduces the problem:

    @Test
    public void testCronFire() throws InterruptedException {
        String drl = "package test.drools\n" +
                     "rule TestRule " +
                     "  timer (cron:* * * * * ?) " +
                     "when\n" +
                     "    String() " +
                     "    Integer() " +
                     "then\n" +
                     "end\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" );
        ksession.fireAllRules();
    }

Comment 2 Mario Fusco 2014-01-29 18:46:20 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/5af33eba2

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.


Note You need to log in before you can comment on or make changes to this bug.