Drools Execution Server memory leak?
by Mike Reynolds
Using: 5.2.0.Final of drools camel server , JSON api, and a Stateless Session
We are making JSON calls to the camel (execution) server. Our
end-to-end unit tests pass. Our load tests, however, show that memory
is never reclaimed after each call to the rules engine. After parsing
through a heap dump, we see the following path taking up over 800 meg of
memory:
(kagent) KnowledgeAgentImpl$ChangeSetNotificationDetector
> (kbase) KnowledgeAgentImpl
>> (ruleBase) KnowledgeBaseImpl
>>> (eventSupport) ReteooRuleBase
>>>> (listeners) RuleBaseEventSupport
>>>>> (array) CopyOnWriteArrayList
>>>>>> ReteooWorkingMemory (around 864K of these)
The rule base is very small and simple - this is only a problem during a load test (or over the course of a weeks worth of calls). We make the following call 10K times:
{
"batch-execution": {
"lookup": "ksession1",
"commands": [
{
"insert": {
"out-identifier": "tc_1",
"object": {.....}
}}]}}
The knowledge-services.xml configures :
- kagent id="agent1" kbase="kbase1" new-instance="true"
- ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"
The rules just update the inserted "timecard" fact.
Because I'm using a stateless session, I don't think I need to
dispose of the agent...and I don't think there is a way to call dispose
using the json/Execution Command api.
We are calling the camel (execution) server from a non-java
environment to process employee timecards entries and evaluate for
overtime calculations.
Thanks!
Mike
14 years, 11 months
Inserting multiple objects of the same class as facts
by Devarakonda, Murty
Hello,
I am facing a problem with the following code with Drools 5.0.1:
I insert multiple objects as facts into my stateful session here:
===============================================================
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
/** mapTypes here is an array of MapType objects **/
for(int i=0;i<mapTypes.length;i++) {
System.out.println("Inserting the fact type: " + mapTypes[i]);
ksession.insert(mapTypes[i]);
}
ksession.insert(ldapLookupKey);
ksession.insert(ldapResponseMap);
ksession.fireAllRules();
ksession.dispose();
===============================================================
And here is my drools file:
===============================================================
rule "LocalRecipient"
when
$myMapType : MapType( name == "LocalRecipient" )
$lookupKey : String()
$ldapResponseMap : Map()
eval( ((($ldapResponseMap.get("zimbraMailDeliveryAddress").equals($lookupKey)) ||
($ldapResponseMap.get("zimbraMailAlias").equals($lookupKey)) ||
($ldapResponseMap.get("zimbraMailCatchAllAddress").equals($lookupKey))) &&
($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) )
then
System.out.println("This LocalRecipient rule should work");
$myMapType.setQueryFilterCheck(true);
end
rule "VirtualMailboxDomain"
when
$myMapType : MapType( name == "VirtualMailboxDomain" )
$lookupKey : String()
$ldapResponseMap : Map()
eval( (($ldapResponseMap.get("zimbraDomainName").equals($lookupKey)) &&
($ldapResponseMap.get("zimbraDomainType").equals("local")) &&
($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) )
then
System.out.println("This VirtualMailboxDomain rule should work");
$myMapType.setQueryFilterCheck(true);
End
===============================================================
Now the problem I am facing is, as long as I defined only rule001 above, it works like a charm and the MapType.QueryFilterCheck flag gets set to TRUE.
As soon I put the rule002 above, I started getting a NullPointerException with the following lines in the stack trace.
===============================================================
Caused by: java.lang.NullPointerException
at com.aol.postfixcache.Rule_LocalRecipient_Rule_0.eval0(Rule_LocalRecipient_Rule_0.java:8)
at com.aol.postfixcache.Rule_LocalRecipient_Rule_0Eval0Invoker.evaluate(Rule_LocalRecipient_Rule_0Eval0Invoker.java:23)
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:117)
===============================================================
I tried different combinations along with an extensive search to see why I am getting this, but couldn't crack it. Appreciate your help.
Regards,
Murty.
14 years, 11 months
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
by bhavindalal
Hello,
I am new to Drools. On starting to execute a simple program, eclipse gives
the following stacktrace as error. I even included the org.eclipse.jdt that
comes with eclipse, but it is still giving me error. Anybody please suggest
the problem. I am using Drools 5.0 and its dependencies and Eclipse Helios
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:321)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/org-eclipse-jdt-internal-compiler-Compi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
a newbi question
by wutongjoe
hello all,
I am a newbi on Drools and started my test work with a modified exapmle
included in drools v4.0.7.The compiled drl from a very simple modified xls
file is like the follwing :
----------------------code-----------------------
package org.drools.examples.decisiontable;
#generated from Decision Table
import org.apache.commons.lang.time.DateUtils;
import java.util.Date;
#From row number: 11
rule "Pricing bracket_11"
when
DateUtils.SEMI_MONTH==1001
then
policy.setBasePrice(9999999);
end
-------------------------code---------------------
but I got an exception stack when trying to addPackage after compile :
--------------stack----------------
Exception in thread "Main Thread" org.drools.rule.InvalidRulePackage:
[9,22]: unknown:9:22 mismatched token: [@46,221:222='==',<76>,9:22];
expecting type LEFT_PAREN
at org.drools.rule.Package.checkValidity(Package.java:424)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
at
org.drools.examples.PricingRuleDTExample.buildRuleBase(PricingRuleDTExample.java:67)
at
org.drools.examples.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:38)
at
org.drools.examples.PricingRuleDTExample.main(PricingRuleDTExample.java:26)
--------------stack----------------
yes,I was trying to test the usage of org.apache.commons.lang.time.DateUtils
inside a xls file,but it seemed something went wrong.Can someone tell me
what caused the exception? thanks a lot
--
View this message in context: http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Re: [rules-users] Help needed
by Mattias Nilsson Grip
prasad.pbc wrote:
>
> Hi Guys,
> Iam using Eclipse tool for writing drl , i have written drl .
> Then i have written an ant script to convert this drl to PKG .
> i have used drools5.1.1.jars. i was sucessfully convert drl to pkg.
>
> knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add( ResourceFactory.newFileResource(
> "c:/Sample.pkg" ),
> ResourceType.PKG );
> iam getting below error:
>
> java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be
> cast to org.drools.rule.Package
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487)
> at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
> at com.test.rules.MyRulesEngine.<init>(MyRulesEngine.java:51)
> at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39)
> at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38)
>
>
> Can anybody help resolving my problem..
>
> Thanks
> prasad
>
Based on the stack trace I would guess that the file Sample.pkg contains a
serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you
could try to do your export like this:
KnowledgeBase kbase = ...;
KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next();
FileOutputStream fos = new FileOutputStream(new File("c:/Sample.pkg"));
DroolsStreamUtils.streamOut(fos, kpackage);
/Mattias
--
View this message in context: http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Regd Drools compatibility with Jboss version
by Dibya Ranjan
Hi
We have a requirement to implement Drools in an application ,which is
hosting the application server in Jboss with version as 3.2.7.
It further uses java 1.4 version with the application being build and
deployed with Ant 1.6.2.
Could anyone help me in providing the Drools version that is compatible with
above .
--
With Warm Regards
Dibya Ranjan
14 years, 11 months