[
https://issues.jboss.org/browse/JBRULES-2887?page=com.atlassian.jira.plug...
]
Wolfgang Laun commented on JBRULES-2887:
----------------------------------------
Manuel Ortiz:
I've executed several times the SampleAlarmRules scenario and found that the problem
in that scenario is the existence of a JoinNode (Node 18) which feeds two nodes, a
JoinNode (Node 20) and an AccumlateNode (Node 25, the one in which NPE occurs). I've
seen that the child tuples of a join node are interconnected via pointers and that those
connections must be updated every time a parent tuple of the join node is modified, via
reAddLeft and reAddRight tuple methods. When a JoinNode feeds two or more nodes, the child
tuples are interconnected in a ordered way that mixes tuples with different sinks.
In the SampleAlarmRules scenario, when JoinNode18 is right modified, the
CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is
returned and reAddLeft'ed, hence breaking the child tuple relations which it seems
necessary to keep rete coherence. After this right modify, the next left modify fails
because a child tuple related to one node of the composite sink is used to check the next
operation to do in another sink node different from the first one. This leads to a chain
of incorrect assertions which ends in the AccumulateNode NPE.
AccumulateNode runs into NPE
----------------------------
Key: JBRULES-2887
URL:
https://issues.jboss.org/browse/JBRULES-2887
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-core
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Priority: Critical
Fix For: 5.2.0.M1
Attachments: DroolsTest.java, SampleAlarmRules.drl
A rule such as
rule "average"
when
B( id < 10 )
$list: List() from collect ( A() over window:time(10s) )
Number( $avg: doubleValue ) from accumulate( A( $id : id ) from $list,
average( $id ) )
then
System.out.println( "average = " + $avg );
end
runs into a NPE
Caused by: java.lang.NullPointerException
at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
at org.drools.reteoo.AccumulateNode.splitList(AccumulateNode.java:920)
at
org.drools.reteoo.AccumulateNode.removePreviousMatchesForLeftTuple(AccumulateNode.java:874)
at org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:205)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:238)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractLeftTupleDestroyRightTuple(CompositeLeftTupleSinkAdapter.java:138)
at org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:212)
at org.drools.reteoo.ModifyPreviousTuples.retractTuples(ModifyPreviousTuples.java:111)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:176)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:450)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:361)
at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183)
at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196)
at event.Rule_launch_0.defaultConsequence(Rule_launch_0.java:7)
at
event.Rule_launch_0DefaultConsequenceInvoker.evaluate(Rule_launch_0DefaultConsequenceInvoker.java:33)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:913)
A null Parameter accctx is passed down from retractLeftTuple.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira