]
Reinis Vicups resolved JBRULES-3416.
------------------------------------
Resolution: Rejected
My testcase/code is erroneous. Specifically this codefragment:
{code}
fooLeft.setBar(fooRight.getBar());
fooRight.setBar(barLeft);
session.update(fooLeftFact, fooLeft);
session.update(fooRightFact, fooRight);
{code}
following fix makes the error go away:
{code}
fooLeft.setBar(fooRight.getBar());
session.update(fooLeftFact, fooLeft);
fooRight.setBar(barLeft);
session.update(fooRightFact, fooRight);
{code}
I am retracting the pull request
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
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: