Details

      Description

      Given rules lead to (presumed) memmory corruption in some data scenarios:

      package de.orbitx.accumulatetesettest;
      import de.orbitx.accumulatesettest.DomainObject;
      import de.orbitx.accumulatesettest.Foo;
      import de.orbitx.accumulatesettest.Bar;
      import de.orbitx.accumulatesettest.Counter;
      
      global DomainObject aggregator;
      rule "reward Bar consolidation"
      when
       $leftFoo : Foo($leftBar : bar, $leftId : id, $leftInterval : interval)
       $rightFoo : Foo(bar == $leftBar, id != $leftId, interval.getStart() < $leftInterval.getStart())
       eval($leftFoo.getInterval().getStart() - $rightFoo.getInterval().getStart() < 4)
      then
       insertLogical(new Counter(1));
       System.out.println("Rewarding leftFoo:" + $leftFoo + " rightFoo:" + $rightFoo);
      end
      
      rule "softConstraintsBroken"
      when
       $softTotal : Number() from accumulate(
       Counter(counterType == 2, $counterType : counterType),sum($counterType))
       $positiveSoftTotal : Number() from accumulate(
       Counter(counterType == 1, $counterType : counterType),sum($counterType))
      then
       aggregator.setValue($softTotal.intValue() - $positiveSoftTotal.intValue());
      end
      

      For instance:

      Foo(id:1, bar:Bar: 0, baz:null, int:Int(start:3, duration:0))
      Foo(id:2, bar:Bar: 0, baz:null, int:Int(start:1, duration:0))
      Foo(id:3, bar:Bar: 1, baz:null, int:Int(start:4, duration:0)) 
      Foo(id:4, bar:Bar: 1, baz:null, int:Int(start:2, duration:0))
      

      session.fireAllRules lead to aggregator.getValue of -2 and following activations

      Rewarding leftFoo:Foo(id:3, bar:Bar: 1, baz:null, int:Int(start:4, duration:0)) rightFoo:Foo(id:4, bar:Bar: 1, baz:null, int:Int(start:2, duration:0))
      Rewarding leftFoo:Foo(id:1, bar:Bar: 0, baz:null, int:Int(start:3, duration:0)) rightFoo:Foo(id:2, bar:Bar: 0, baz:null, int:Int(start:1, duration:0))
      

      when swapping Bars of Foo 1 and Foo 3:

      Foo(id:1, bar:Bar: 1, baz:null, int:Int(start:3, duration:0))
      Foo(id:3, bar:Bar: 0, baz:null, int:Int(start:4, duration:0))
      

      session.fireAllRules lead to aggregator.getValue of -1 and following activations

      Rewarding leftFoo:Foo(id:3, bar:Bar: 0, baz:null, int:Int(start:4, duration:0)) rightFoo:Foo(id:2, bar:Bar: 0, baz:null, int:Int(start:1, duration:0))
      

      Second activation for the Foo 1 and Foo 4 does not happen, thus Geoffreys assumption is that working memory is corrupted.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mark.proctor Mark Proctor
                Reporter:
                reinis Reinis Vicups
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: