<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I have managed to reduce down the project from mxv into a single unit test that can be added to Misc2Test. I turned tracing on, and it fails while evaluating R1:</div><div><div>2014-02-25 05:00:16,192 [main] TRACE Rule[name=R1] segments=2 TupleSets[insertSize=0, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:00:16,192 [main] TRACE &nbsp; &nbsp; &nbsp;11 [JoinNode(5) - [ClassObjectType class=org.drools.compiler.integrationtests.Misc2Test$Foo2]] TupleSets[insertSize=0, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:00:16,192 [main] TRACE &nbsp; &nbsp; &nbsp;Skip Segment 0</div><div>2014-02-25 05:00:16,192 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;Segment 1</div><div>2014-02-25 05:00:16,192 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;11 [JoinNode(7) - [ClassObjectType class=org.drools.compiler.Person]] TupleSets[insertSize=0, deleteSize=0, updateSize=1]</div><div>2014-02-25 05:00:16,193 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;rightTuples TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div></div><div>I’ve provided the new test and the full trace log below.</div><div><br></div><div>The problem is the node sharing of Foo2. R1 thinks it’s propagating an update, when it never passed R1’s Foo2 before, so it should propagate as an update for R2 but an insert for R1. I suspect the problem is related to the SegmentPropagator when it is updated after moving from the first shared segment, to the two child segments.</div><div><br></div><div>Please try to avoid submitting project jars. It takes a lot more time for us to setup and work with, which will delay our time in getting back to you. Ideally create a reduced single test method, as per blow, that is self contained, and submit it with pull request and associated JIRA. see:</div><div><a href="http://docs.jboss.org/drools/release/5.6.0.Final/droolsjbpm-introduction-docs/html/gettingstarted.html">http://docs.jboss.org/drools/release/5.6.0.Final/droolsjbpm-introduction-docs/html/gettingstarted.html</a></div><div><br></div><div><br></div><div><div style="border:1px inset;padding:2%;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 6px; background-color: rgb(255, 255, 255); font-family: Menlo; position: static; z-index: auto;" bgcolor="#ffffff"><font color="#808000">@Test
</font><font color="#000080"><b>public void </b></font><font color="#000000">testSharedNotWithLeftUpdateAndRightInsert() </font><font color="#000080"><b>throws </b></font><font color="#000000">Exception {
</font><font color="#000000">    String str =
</font><font color="#000000">            </font><font color="#008000"><b>"import " </b></font><font color="#000000">+ Foo.</font><font color="#000080"><b>class</b></font><font color="#000000">.getCanonicalName() + </font><font color="#008000"><b>";</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"import " </b></font><font color="#000000">+ Foo2.</font><font color="#000080"><b>class</b></font><font color="#000000">.getCanonicalName() + </font><font color="#008000"><b>";</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"import " </b></font><font color="#000000">+ Person.</font><font color="#000080"><b>class</b></font><font color="#000000">.getCanonicalName() + </font><font color="#008000"><b>";</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"rule R1 when</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    f1 : Foo( )</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    Foo2( )</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    Person( age == f1.x )</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"then</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"end</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"rule R2 when</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    Foo(  )</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    f2 : Foo2( )</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    not Person()</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"then</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    modify( f2 ) { x = 3};</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"    insert( new Person() );</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>" </b></font><font color="#000000">+
</font><font color="#000000">            </font><font color="#008000"><b>"end</b></font><font color="#000080"><b>\n</b></font><font color="#008000"><b>"</b></font><font color="#000000">;
</font><font color="#000000">
</font><font color="#000000">    KnowledgeBase kbase = loadKnowledgeBaseFromString(str);
</font><font color="#000000">    StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
</font><font color="#000000">    Foo f1 = </font><font color="#000080"><b>new </b></font><font color="#000000">Foo();
</font><font color="#000000">    Foo2 f2 = </font><font color="#000080"><b>new </b></font><font color="#000000">Foo2();
</font><font color="#000000">    ksession.insert( f1 );
</font><font color="#000000">    ksession.insert( f2 );
</font><font color="#000000">    </font><font color="#000000"><i>assertEquals</i></font><font color="#000000">(</font><font color="#0000ff">2</font><font color="#000000">, ksession.fireAllRules() );
</font><font color="#000000">    </font><font color="#000000"><i>assertEquals</i></font><font color="#000000">( </font><font color="#0000ff">3</font><font color="#000000">, f2.getX() );
</font><font color="#000000">}</font></pre></div><div><br></div></div><div>For those interested, here is the full trace output once trace is turned on:</div><div><br></div><div><div><div>2014-02-25 05:13:33,610 [main] DEBUG Starting Engine in PHREAK mode</div><div>2014-02-25 05:13:33,715 [main] TRACE Adding Rule R1</div><div>2014-02-25 05:13:33,720 [main] TRACE Adding Rule R2</div><div>2014-02-25 05:13:33,809 [main] TRACE Insert [fact 0:1:1668059028:1668059028:1:DEFAULT:NON_TRAIT:org.drools.compiler.integrationtests.Misc2Test$Foo@636c8f94]</div><div>2014-02-25 05:13:33,822 [main] TRACE LinkNode notify=false nmask=1 smask=1 spos=0 rules=</div><div>2014-02-25 05:13:33,823 [main] TRACE &nbsp; LinkSegment smask=2 rmask=2 name=R2</div><div>2014-02-25 05:13:33,831 [main] TRACE LinkNode notify=true nmask=1 smask=1 spos=0 rules=[RuleMem R1], [RuleMem R2]</div><div>2014-02-25 05:13:33,832 [main] TRACE Insert [fact 0:2:588638666:588638666:2:DEFAULT:NON_TRAIT:org.drools.compiler.integrationtests.Misc2Test$Foo2@2315e9ca]</div><div>2014-02-25 05:13:33,833 [main] TRACE BetaNode insert=1 stagedInsertWasEmpty=true</div><div>2014-02-25 05:13:33,833 [main] TRACE LinkNode notify=true nmask=2 smask=3 spos=0 rules=[RuleMem R1], [RuleMem R2]</div><div>2014-02-25 05:13:33,833 [main] TRACE &nbsp; LinkSegment smask=1 rmask=1 name=R1</div><div>2014-02-25 05:13:33,834 [main] TRACE &nbsp; LinkSegment smask=1 rmask=3 name=R2</div><div>2014-02-25 05:13:33,834 [main] TRACE &nbsp; &nbsp; LinkRule name=R2</div><div>2014-02-25 05:13:33,855 [main] TRACE Queue RuleAgendaItem [Activation rule=R2, act#=0, salience=0, tuple=null]</div><div>2014-02-25 05:13:33,856 [main] TRACE Queue Added 1 [Activation rule=R2, act#=0, salience=0, tuple=null]</div><div>2014-02-25 05:13:33,856 [main] TRACE Rule[name=R2] segments=2 TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,856 [main] TRACE &nbsp; &nbsp; &nbsp;1 [JoinNode(5) - [ClassObjectType class=org.drools.compiler.integrationtests.Misc2Test$Foo2]] TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,857 [main] TRACE &nbsp; &nbsp; &nbsp;Segment 0</div><div>2014-02-25 05:13:33,857 [main] TRACE &nbsp; &nbsp; &nbsp;1 [JoinNode(5) - [ClassObjectType class=org.drools.compiler.integrationtests.Misc2Test$Foo2]] TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,865 [main] TRACE &nbsp; &nbsp; &nbsp;rightTuples TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,867 [main] TRACE &nbsp; &nbsp; &nbsp;Segment 1</div><div>2014-02-25 05:13:33,867 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;2 [NotNode(9) - [ClassObjectType class=org.drools.compiler.Person]] TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,867 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;Segment 1</div><div>2014-02-25 05:13:33,868 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;2 [NotNode(9) - [ClassObjectType class=org.drools.compiler.Person]] TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,868 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;rightTuples TupleSets[insertSize=0, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,870 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 [RuleTerminalNode(10): rule=R2] TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,871 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Segment 1</div><div>2014-02-25 05:13:33,871 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 [RuleTerminalNode(10): rule=R2] TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,871 [main] TRACE Fire "R2"&nbsp;</div><div>[[ R2 active=false ] [ null</div><div>[fact 0:2:588638666:588638666:2:DEFAULT:NON_TRAIT:org.drools.compiler.integrationtests.Misc2Test$Foo2@2315e9ca]</div><div>[fact 0:1:1668059028:1668059028:1:DEFAULT:NON_TRAIT:org.drools.compiler.integrationtests.Misc2Test$Foo@636c8f94] ] ]</div><div>2014-02-25 05:13:33,877 [main] TRACE Update [fact 0:2:588638666:588638666:3:DEFAULT:NON_TRAIT:org.drools.compiler.integrationtests.Misc2Test$Foo2@2315e9ca]</div><div>2014-02-25 05:13:33,879 [main] TRACE &nbsp; LinkSegment smask=1 rmask=1 name=R1</div><div>2014-02-25 05:13:33,879 [main] TRACE &nbsp; LinkSegment smask=1 rmask=3 name=R2</div><div>2014-02-25 05:13:33,879 [main] TRACE &nbsp; &nbsp; LinkRule name=R2</div><div>2014-02-25 05:13:33,880 [main] TRACE Insert [fact 0:3:1618732380:-62068830:4:DEFAULT:LEGACY_TRAITABLE:[Person name='null age='0' likes='null']]</div><div>2014-02-25 05:13:33,880 [main] TRACE BetaNode insert=1 stagedInsertWasEmpty=true</div><div>2014-02-25 05:13:33,880 [main] TRACE LinkNode notify=true nmask=1 smask=1 spos=1 rules=[RuleMem R1]</div><div>2014-02-25 05:13:33,880 [main] TRACE &nbsp; LinkSegment smask=2 rmask=3 name=R1</div><div>2014-02-25 05:13:33,881 [main] TRACE &nbsp; &nbsp; LinkRule name=R1</div><div>2014-02-25 05:13:33,881 [main] TRACE Queue RuleAgendaItem [Activation rule=R1, act#=2, salience=0, tuple=null]</div><div>2014-02-25 05:13:33,881 [main] TRACE Queue Added 1 [Activation rule=R1, act#=2, salience=0, tuple=null]</div><div>2014-02-25 05:13:33,881 [main] TRACE LinkNode notify=true nmask=1 smask=1 spos=1 rules=[RuleMem R2]</div><div>2014-02-25 05:13:33,882 [main] TRACE &nbsp; LinkSegment smask=2 rmask=3 name=R2</div><div>2014-02-25 05:13:33,882 [main] TRACE &nbsp; &nbsp; LinkRule name=R2</div><div>2014-02-25 05:13:33,882 [main] TRACE Rule[name=R1] segments=2 TupleSets[insertSize=0, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,882 [main] TRACE &nbsp; &nbsp; &nbsp;4 [JoinNode(5) - [ClassObjectType class=org.drools.compiler.integrationtests.Misc2Test$Foo2]] TupleSets[insertSize=0, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,883 [main] TRACE &nbsp; &nbsp; &nbsp;Segment 0</div><div>2014-02-25 05:13:33,883 [main] TRACE &nbsp; &nbsp; &nbsp;4 [JoinNode(5) - [ClassObjectType class=org.drools.compiler.integrationtests.Misc2Test$Foo2]] TupleSets[insertSize=0, deleteSize=0, updateSize=0]</div><div>2014-02-25 05:13:33,884 [main] TRACE &nbsp; &nbsp; &nbsp;rightTuples TupleSets[insertSize=0, deleteSize=0, updateSize=1]</div><div>2014-02-25 05:13:33,884 [main] TRACE &nbsp; &nbsp; &nbsp;Segment 1</div><div>2014-02-25 05:13:33,884 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;5 [JoinNode(7) - [ClassObjectType class=org.drools.compiler.Person]] TupleSets[insertSize=0, deleteSize=0, updateSize=1]</div><div>2014-02-25 05:13:33,884 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;Segment 1</div><div>2014-02-25 05:13:33,885 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;5 [JoinNode(7) - [ClassObjectType class=org.drools.compiler.Person]] TupleSets[insertSize=0, deleteSize=0, updateSize=1]</div><div>2014-02-25 05:13:33,885 [main] TRACE &nbsp; &nbsp; &nbsp; &nbsp;rightTuples TupleSets[insertSize=1, deleteSize=0, updateSize=0]</div></div><div><br></div><div>java.lang.NullPointerException</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.core.util.index.LeftTupleIndexHashTable.remove(LeftTupleIndexHashTable.java:386)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.core.phreak.RuleNetworkEvaluator.doUpdatesReorderLeftMemory(RuleNetworkEvaluator.java:799)</div></div><div><br></div><div><br></div></body></html>