[JBoss JIRA] Created: (JBRULES-1471) Accumulate should not call getResult() more then necessary
by Geoffrey De Smet (JIRA)
Accumulate should not call getResult() more then necessary
----------------------------------------------------------
Key: JBRULES-1471
URL: http://jira.jboss.com/jira/browse/JBRULES-1471
Project: JBoss Drools
Issue Type: Task
Security Level: Public (Everyone can see)
Components: Reteoo
Reporter: Geoffrey De Smet
Assigned To: Edson Tirelli
Fix For: 5.0.0-M1
For this rule:
rule "roomCapacityTooSmall" // TODO it takes 50-90% of the performance of drools-solver
when
$period : Period();
$room : Room($capacity : capacity);
$totalStudentSize : Number(intValue > $capacity) from accumulate(
Exam(period == $period, room == $room, $studentSize : topicStudentSize),
sum($studentSize)
);
...
end
Outside drl, I update 2 out of 700 Exam objects and call fireAllRulesAndCalculateDecisionScore.
The drl never changes an Exam. Period and Room never change.
That results into this log:
Breakpoint reached at org.drools.solver.core.evaluation.EvaluationHandler.fireAllRulesAndCalculateDecisionScore(EvaluationHandler.java:90)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.reverse(SumAccumulateFunction.java:62)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.accumulate(SumAccumulateFunction.java:53)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.reverse(SumAccumulateFunction.java:62)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.accumulate(SumAccumulateFunction.java:53)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.reverse(SumAccumulateFunction.java:62)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.accumulate(SumAccumulateFunction.java:53)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.reverse(SumAccumulateFunction.java:62)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.accumulate(SumAccumulateFunction.java:53)
Breakpoint reached at org.drools.base.accumulators.SumAccumulateFunction.getResult(SumAccumulateFunction.java:70)
There are 4 accumulate calls and 4 reverse calls. That might be accurate.
There are 8 getResult calls, that should only be 1.
Also, the getResult method creates a new Double instance each time:
return new Double( data.total );
It might be better to do
return Double.valueOf(data.total);
to allow the JVM to hot spot optimize it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-946) RuleBase serialization fails with StackOverflowError
by Alexandre Gattiker (JIRA)
RuleBase serialization fails with StackOverflowError
----------------------------------------------------
Key: JBRULES-946
URL: http://jira.jboss.com/jira/browse/JBRULES-946
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.0.MR2
Reporter: Alexandre Gattiker
Assigned To: Mark Proctor
I created 920 rules, all in this format, with different values in the string literals.
rule "Rule_1"
when
$g:Parent()
$c:Child(parent==$g,code=="yyy1")
Item(parentObject==$c,name=="xxx1", value == "1")
Item(parentObject==$c,name=="xxx2",value == "1")
Item(parentObject==$g,name=="xxx3",value == "200")
then
System.out.println("2");
end
With the following code, I create a RuleBase that I serialize.
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
conf.setCompiler(PackageBuilderConfiguration.JANINO);
Reader source = new InputStreamReader(PolicyServiceImpl.class.getResourceAsStream(fileName));
PackageBuilder builder = new PackageBuilder(conf);
builder.addPackageFromDrl(source);
Package pkg = builder.getPackage();
ruleBase.addPackage(pkg);
//serialize RuleBase
File outFile = new File(f.getPath() + ".tmp");
FileOutputStream fout = new FileOutputStream(outFile);
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(ruleBase);
oos.close();
The serialization fails with the following exception. Otherwise the RuleBase is perfectly fine and working.
java.lang.StackOverflowError
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream$BlockDataOutputStream.write(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java(Compiled Code))
at java.util.ArrayList.writeObject(ArrayList.java(Compiled Code))
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Inlined Compiled Code))
at java.util.ArrayList.writeObject(ArrayList.java(Compiled Code))
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Inlined Compiled Code))
at java.util.ArrayList.writeObject(ArrayList.java(Compiled Code))
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code))
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
(last four lines repeated over 1000 times)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-2079) ruleBase.addPackage(packageBuilder.getPackage()); should fail-fast with a clear error message if the packageBuilder has any errors
by Geoffrey De Smet (JIRA)
ruleBase.addPackage(packageBuilder.getPackage()); should fail-fast with a clear error message if the packageBuilder has any errors
----------------------------------------------------------------------------------------------------------------------------------
Key: JBRULES-2079
URL: https://jira.jboss.org/jira/browse/JBRULES-2079
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.0.0.CR1
Reporter: Geoffrey De Smet
Assignee: Mark Proctor
Priority: Minor
Fix For: 5.1.0.M1
After you 've build your package with packageBuilder,
you've either called the hasErrors() method and done something about it
or you didn't check the hasErrors() method because you didn't know (or want to know) it existed and you expect it to throw an exception because hasErrors() returns true.
The principle of least surpise. You don't expect that it continues like everything is cool (while it's not) and crashes the moment you fire your first rules.
The exception should be a runtime exception and the message should at least mention the first of the errors.
The exception should probably contain a list of all errors of course too as a property.
See InvalidStateException in hibernate-validator.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-2125) Drools core multithreading issue
by Andrey Nechaev (JIRA)
Drools core multithreading issue
--------------------------------
Key: JBRULES-2125
URL: https://jira.jboss.org/jira/browse/JBRULES-2125
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.0.1.FINAL
Environment: Java HotSpot v 1.6.0_06, WinXP SP3
Reporter: Andrey Nechaev
Assignee: Mark Proctor
Attachments: Main.java
Attachement below is the code showing the problems.
The program hangs and nothing is displayed in the Console.
If I put lines 10-11 before the line 6, I get a NullPointerException:
Exception in thread "main" java.lang.NullPointerException
at org.drools.reteoo.ObjectSource.addObjectSink(ObjectSource.java:124)
...
But, if I comment out the lines 2&3, everything works ok.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-2253) ClassNotFound when ASM optimizer kicks in in MVEL consequence
by Michael Neale (JIRA)
ClassNotFound when ASM optimizer kicks in in MVEL consequence
-------------------------------------------------------------
Key: JBRULES-2253
URL: https://jira.jboss.org/jira/browse/JBRULES-2253
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.0.1.FINAL
Reporter: Michael Neale
Assignee: Michael Neale
Priority: Critical
Fix For: 5.1.0.M1
(ok if the subject is really confusing, perhaps this bug isn't for you).
In chasing down JBRULES-2234 I found this. Instructions (apologies for relying on Guvnor to reproduce):
To reproduce is not
easy, but here are some instructions:
* Run latest Guvnor (if you are able to, if not, then the rest is moot !).
* Import the attached repo (unzip it first).
* browse to KnowledgeBases/org/acme/insurance/pricing/
- press "build package"
* shut it down, restart (flushes caches etc...)
Then:
* browse to KnowledgeBases/org/acme/insurance/pricing/Test Scenarios
* open PolicyQuotePackageTest
* run it:
Now you should see an exception like this:
Caused by: java.lang.NoClassDefFoundError: org/acme/insurance/Policy
at ASMAccessorImpl_62408281250565694450.setValue(Unknown Source)
at org.mvel2.optimizers.dynamic.DynamicSetAccessor.setValue(DynamicSetAccessor.java:74)
at org.mvel2.compiler.CompiledAccExpression.setValue(CompiledAccExpression.java:47)
at org.mvel2.MVEL.executeSetExpression(MVEL.java:962)
at org.mvel2.ast.WithNode$ParmValuePair.eval(WithNode.java:242)
at org.mvel2.ast.WithNode.getReducedValueAccelerated(WithNode.java:67)
at org.mvel2.ast.InterceptorWrapper.getReducedValueAccelerated(InterceptorWrapper.java:38)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104)
at org.mvel2.MVEL.executeExpression(MVEL.java:995)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:91)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:966)
This is due to it loading a previously serialized version of the KB.
If it was to run off a freshly compiled one, its all fine. Also, if I
tell MVEL to NOT use ASM optimizer, it works fine (using reflection).
So clearly the stuff is available to the classpath in the right
places... its only to do with ASM in mvel post deserialization. (and
for that to happen, MVEL has to execute the compiled expression enough
to kick in the JIT).
MVELCompilationUnit in drools is worth examining too... still not sure where the problem lies.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-2179) better integration of ruleflow and AgendaFilter
by Michal Bali (JIRA)
better integration of ruleflow and AgendaFilter
-----------------------------------------------
Key: JBRULES-2179
URL: https://jira.jboss.org/jira/browse/JBRULES-2179
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.0.1.FINAL
Reporter: Michal Bali
Assignee: Mark Proctor
Fix For: 5.1.0.M1
Attachments: agendaFilterWithRuleflow.zip
Hi,
I am creating this issue so that it won't be lost. See this post for more information: http://lists.jboss.org/pipermail/rules-users/2009-May/009110.html
My original email with one reply message is pasted below:
--------------------------------------------------------------
If a rule is not allowed to fire by an AgendaFilter the whole ruleflow stops.
I've created a small test case (attached). It contains:
- one DRL file with one dummy rule that is in some ruleflow-group.
- one RF file with three nodes ('start', 'ruleflow group' and 'end')
- a program that starts the process, and calls fireAllRules with custom agenda filter.
Once the program is executed the ruleflow will stop inside the ruleflow-group. If I remove the agenda filter it works as expected (the ruleflow finishes).
Tested with Drools 5.0.1.
Best regards,
Michal
----------------------------------------
Final reply from Mark:
It seems like a reasonable request, that if all the rules have been cancelled, fired or filtered that the ruleflow-group should be de-activated so the flow can continue. We'll look into it for 5.1.
---------------------------------------
Thanking you in advance,
Michal
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months