[jboss-jira] [JBoss JIRA] (JBRULES-3416) WorkingMemory corruption

Reinis Vicups (JIRA) jira-events at lists.jboss.org
Sat Mar 10 10:26:48 EST 2012


    [ https://issues.jboss.org/browse/JBRULES-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675713#comment-12675713 ] 

Reinis Vicups commented on JBRULES-3416:
----------------------------------------

laune has reported that he is unable to replicate the working memory correction (assertion is not failing) here: http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-Hard-constraint-appears-to-be-ignored-tp3777209p3777209.html
                
> WorkingMemory corruption
> ------------------------
>
>                 Key: JBRULES-3416
>                 URL: https://issues.jboss.org/browse/JBRULES-3416
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler (expert), drools-core  (expert)
>    Affects Versions: 5.4.0.Beta2
>         Environment: linux ubuntu; java version "1.6.0_26"; Java(TM) SE Runtime Environment (build 1.6.0_26-b03); Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)
>            Reporter: Reinis Vicups
>            Assignee: Mark Proctor
>
> Given rules lead to (presumed) memmory corruption in some data scenarios:
> {code}
> 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
> {code}
> For instance:
> {code}
> 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))
> {code}
> session.fireAllRules lead to aggregator.getValue of -2 and following activations
> {code}
> 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))
> {code}
> when swapping Bars of Foo 1 and Foo 3:
> {code}
> 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))
> {code}
> session.fireAllRules lead to aggregator.getValue of -1 and following activations
> {code}
> 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))
> {code}
> Second activation for the Foo 1 and Foo 4 does not happen, thus Geoffreys assumption is that working memory is corrupted.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list