Hi Wolfgang:<div><br></div><div>I write to you concerning JIRA <span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><a href="https://issues.jboss.org/browse/JBRULES-2887" style="color:rgb(0, 0, 204)" target="_blank">https://issues.jboss.org/browse/JBRULES-2887</a>, which the SampleAlarmRules scenario which was attached to this discussion was added in. </span></div>
<div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><br></span></div><div>I&#39;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&#39;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. </div>
<div><br></div><div>In the SampleAlarmRules scenario, when JoinNode18 is right modified, the CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is returned and reAddLeft&#39;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.</div>
<div><br></div><div>I&#39;ve rewriten my rules in order to JoinNode18 feeds only AccumulateNode25 thus avoiding the NPE and returning to my user role. However I am not sure if any CompositeSink starting at a JoinNode will have this or other problems when being left or right modified. I hope this information helps to solve this problem.</div>
<div><br></div><div>Best regards,</div><div><br></div><div>Manuel Ortiz.</div><div><br></div><div><br></div><div>
<div class="gmail_quote">2011/3/31 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br><br><div class="gmail_quote"><div>2011/3/31 Manuel Ortiz <span dir="ltr">&lt;<a href="mailto:manuel.ortizramos@gmail.com" target="_blank">manuel.ortizramos@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">



Hi Wofgang:<div><br></div><div>Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful.</div><div><br></div></blockquote></div><div><div></div><div>
<div><br>Thanks. Files are attached to the JIRA and JIRA is now at &quot;critical&quot;.<br>
-W<br> </div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div></div><div>Best regards,</div><div><br></div><font color="#888888"><div>
Manuel Ortiz.</div></font><div><div></div><div><div><br><br><div class="gmail_quote">2011/3/31 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span><br>



<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Manuel,<br><br>I have reported this (or a very similar) problem <a href="https://issues.jboss.org/browse/JBRULES-2887" target="_blank">https://issues.jboss.org/browse/JBRULES-2887</a>  with a small example to reproduce.<br>




<br>The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an &quot;accumulate&quot; phrase, (If this pattern is different from the one I gave, I&#39;ll raise the issue priority to &quot;critical&quot;.)<br>





<br>Cheers<br><font color="#888888">Wolfgang<br><br><br></font><div class="gmail_quote"><div>2011/3/30 Manuel Ortiz <span dir="ltr">&lt;<a href="mailto:manuel.ortizramos@gmail.com" target="_blank">manuel.ortizramos@gmail.com</a>&gt;</span><br>




</div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div>
Hello all!<div><br></div><div>I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I&#39;ve been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine...</div>






<div><br></div><div><div>java.lang.NullPointerException</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:172)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196)</div><div><span style="white-space:pre-wrap">        </span>at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.defaultConsequence(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.java:18)</div>






<div><span style="white-space:pre-wrap">        </span>at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.evaluate(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.java:44)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)</div>






<div><span style="white-space:pre-wrap">        </span>at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)</div><div><span style="white-space:pre-wrap">        </span>at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)</div>






</div><div><br></div><div>I&#39;ve been trying to find the problem, and found a strange interaction between three rules that makes the null pointer to appear. The alarm system has many rules now and it is difficult to simplify the scenario, so I just would like to know what is the funcion of AccumulateNode object in order to have an idea of the NullPointerException possible cause.</div>






<div><br></div><div>Can anyone help me?</div><div><br></div><div>Thank you in advance for your time.</div><div><br></div><div>Regards,</div><div><br></div><font color="#888888"><div>Manuel Ortiz.</div><div><br></div>
</font><br></div></div><div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></div></blockquote></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div></div></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div>