[jboss-jira] [JBoss JIRA] (JBRULES-3416) WorkingMemory corruption
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Thu Apr 5 09:31:48 EDT 2012
[ https://issues.jboss.org/browse/JBRULES-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682057#comment-12682057 ]
Mark Proctor commented on JBRULES-3416:
---------------------------------------
After further investigation, will have to mark this as a "won't fix". Fact's work of head of index buckets and are used for equality checks. If you change a fact's values without updating the engine, then other fact updates have problems and not identify the buckets they should be in.
In short either use modify, which avoids this problem, or call update after changes on one fact before making changes to another fact.
> 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.3.1.Final, 5.4.0.Beta2, 5.4.0.CR1
> 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
> Fix For: 5.4.0.Final
>
>
> 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