Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-339

Rules will only fire in the first session created from a knowledgebase - Segment Memory restore from Prototype conflict

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 6.0.1.Final
    • 6.0.0.CR5
    • None
    • None

    Description

      Given a KB with the two rules below:

       rule "Insert Info "
       when
       then
           insert(  "aaa " );
           insert( new Integer( 12 ) );
           insert( new Double( 4.0 ) );
       end
       
       rule "React "
       when
           Integer()
           accumulate (
                        $n : Double( ) and
                             Double(  ),
                        $x : count( $n )
                      )
           String( )
       then
           System.out.println(  "Rule fires" );
       end
      

      The rules work normally in the first session created from the KB.
      When any additional session is created and used, the SegmentMemories are restored from the SM Prototypes.
      Unfortunately, the AccumulateNode -> RuleTerminalNode segment is restored twice, once when the "aaa"
      triggers the appropriate Beta Node, and once when the subnetwork updates the RIA node.
      The latter overwrites the already existing segment, overriding the partial link bits.

      See SegmentUtilities line 421, where this tentative patch shows the problem:

      if ( NodeTypeEnums.isLeftTupleSource(node) &&  wm.getNodeMemory((MemoryFactory) node).getSegmentMemory() == null )
      

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            dsotty Davide Sottara (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: