Re: [rules-users] RuleBase Question
OK. The reason why I don't want to use KnowledgeAgent is because I want the DRL scanning to be done synchronously once I send a JMX message and not by having the KnowledgeAgent polls the resource folder for changes every x time units. Can I do that? Basically, I want another application to send a signal to start scanning the DRL folder for changed files and then compile and re-add only those that have been modified. I am currently using the file modification time to determine what has changed since last time. Is there a better approach? Right now I have a JMX bean that scans the folder, and grabs the DRLs that got changed, and only recompile those, then re-add them to the RuleBase, then get a new stateful session the next execution. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p889922.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ArrayIndexOutOfBounds when calling addKnowledgePackage?
Yes. Actually that is exactly what I did, but I wanted to test something out in the process and I decided to try it like that. But in any case, I am using your line instead. I wrote the disclaimer in the email I sent with the code :) On Mon, May 24, 2010 at 12:59 AM, Wolfgang Laun-2 [via Drools - Java Rules Engine] ml-node+838997-848786506-94...@n3.nabble.comml-node%2b838997-848786506-94...@n3.nabble.com wrote: On 23 May 2010 15:31, malkhafaji [hidden email]http://user/SendEmail.jtp?type=nodenode=838997i=0 wrote: Hello, I am trying to create a bunch of KnowledgeBase objects, this is what I am doing: 1. create one List of KnowledgePackage objects (pre-compile them). 2. Create X number of KnowledgeBases, and for each knowledge base do this: for (KnowledgePackage kp : this.knowledgePackages) { CollectionKnowledgePackage collections = new ArrayListKnowledgePackage(); collections.add(kp); knowledgeBase.addKnowledgePackages(collections); } This is a very circumstantial way of doing knowledgeBase.addKnowledgePackages( this.knowledgePackages ); -W ___ rules-users mailing list [hidden email] http://user/SendEmail.jtp?type=nodenode=838997i=1 https://lists.jboss.org/mailman/listinfo/rules-users -- View message @ http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p838997.html To unsubscribe from ArrayIndexOutOfBounds when calling addKnowledgePackage?, click herehttp://drools-java-rules-engine.46999.n3.nabble.com/subscriptions/Unsubscribe.jtp?code=bW9lLmFsa2hhZmFqaUBtZWRjcHUuY29tfDgzNzg0MXwtMTQyNzk2NjgzMQ==. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p839339.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] ArrayIndexOutOfBounds when calling addKnowledgePackage?
Hello, I am trying to create a bunch of KnowledgeBase objects, this is what I am doing: 1. create one List of KnowledgePackage objects (pre-compile them). 2. Create X number of KnowledgeBases, and for each knowledge base do this: for (KnowledgePackage kp : this.knowledgePackages) { CollectionKnowledgePackage collections = new ArrayListKnowledgePackage(); collections.add(kp); knowledgeBase.addKnowledgePackages(collections); } Please forget about optimizations for now, this is just an isolated test to solve this issue. So, notice how I am using the SAME list of KnowledgePackage objects, but to initialize MULTIPLE KnowledgeBase instances. Here is the exception that I am getting (and sometimes I get it sometimes I don't on the same code!). This exception happens exactly at the addKnowledgePackage line (last line in the loop above). One last piece of information, I am executing the code above in a thread, meaning multiple threads are accessing the same KnowledgePackage array list but populating totally distinct KnowledgeBases. Any idea any one? Exception in thread KnowledgeBasePoolObject_Init_1 java.lang.ArrayIndexOutOfBo undsException: 7 at java.util.ArrayList.add(Unknown Source) at org.drools.rule.EvalCondition.clone(EvalCondition.java:135) at org.drools.rule.LogicTransformer$AndOrTransformation.transform(LogicT ransformer.java:330) at org.drools.rule.LogicTransformer.applyOrTransformation(LogicTransform er.java:242) at org.drools.rule.LogicTransformer.processTree(LogicTransformer.java:23 2) at org.drools.rule.LogicTransformer.transform(LogicTransformer.java:81) at org.drools.rule.Rule.getTransformedLhs(Rule.java:523) at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder .java:97) at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:117) at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:409) at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:635) at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java: 517) at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:426) at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseI mpl.java:121) at com.medcpu.mpu.pp.engine.KnowledgeBasePool.getNewKnowledgeBasePoolObj ect(KnowledgeBasePool.java:125) -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p837841.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ArrayIndexOutOfBounds when calling addKnowledgePackage?
And for the same isolated test, but in a different run, I also get this (exactly at the same line): P.S. I was just trying to create 7 KnowledgeBase instances. I am also running with a huge perm memory setting: -XX:PermSize=128m -XX:MaxPermSize=672 Exception in thread main java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindCla ss(JavaDialectRuntimeData.java:440) at org.drools.rule.CompositeClassLoader.fastFindClass(CompositeClassLoad er.java:53) at org.drools.rule.CompositeClassLoader.loadClass(CompositeClassLoader.j ava:68) at java.lang.ClassLoader.loadClass(Unknown Source) at org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.ja va:306) at org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.ja va:297) at org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(JavaDialectRun timeData.java:143) at org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(DialectRuntime Registry.java:114) at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java: 481) at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:426) at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseI mpl.java:121) -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p837849.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ArrayIndexOutOfBounds when calling addKnowledgePackage?
Additional information. When I removed the threads (everything executing sequentially), I got rid of the first problem above which is the index out of bounds exception. However, I am consistently getting the perm gen out of memory exception although I have plenty of it. So, I decided to create those 7 instances of KnowledgeBase objects and not save them in memory (leave them eligible for GC) and I was able to get up to 20 instances created. When I added the statement that adds every newly created KnowledgeBase to an existing array list, that is when I got the memory exception again at around 5/6 KnowledgeBase. If I try to create KnowledgeBase instances WITHOUT adding KnowledgePackages to it (I am adding a total of 6), then I can create all KnowledgeBase successfully. I even created a whole new KnolwedgePackage array list from scratch on every creation of KnowledgeBase just to isolate any potential problems due to sharing of the array list among the newly created KnowledgeBases, and the issue remains the same (memory error). So, it is not the sharing of the array list of KnowledgePackage instances, it is not the fact that I am creating multiple KnowledgeBases in memory. It is the fact that I am creating multiple instances of KnowledgeBase objects AND adding 6 KnowledgePackage objects to each one. I max out at around 5/6 and then it fails. Here is the last run that failed (I printed out Runtime...freeMemory() and availableMemory()): Free memory: 45 MB Available memory: 254 MB Then the exception right when I wanted to add KP array list to the next KnowledgeBase. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p837886.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ArrayIndexOutOfBounds when calling addKnowledgePackage?
For those that are interested. I solved the problem. Basically I got over the following inherent problems in Drools (not that they are bugs, but they did not suit my application requirements): 1. A new class loader for each KnowledgeBase. This caused about 20-30K classes loaded per KnowledgeBase causing me the Perm gen errors. If I increased the Perm gen memory parameters, I got hit on the native thread creation issue (the more memory your application consumes, the less threads you can instantiate because you will have less memory to work with). 2. The time taken to compile the KnowledgePackages AND to add them to each KnowledgeBase. So, what I did was a combination of a few things: 1. I created one KnowledgeBase and loaded all the KnowledgePackages that I needed to load in it. Serialized it to a file. And retrieved X instances and added them to a pool. Now, I have X KnowledgeBase instances without the heavy class loading that comes with creating each one if you use the regular way of creating it from scratch. When you de-serialize it, there are a lot less classes loaded. Doing this also allowed me to avoid compiling the KnowledgePackages on start up, and now my application starts up immediately like a bullet :) 2. I changed some of my JVM parameters to add very aggressive GC parameters. The fact that I was able to avoid using many class loaders for each instantiation of a KnowledgeBase allowed me to reduce the Perm Gen memory setting which allowed me more memory for my threads :) my application is actually thread heavy, and why not when we have an 8-core server!! I am using the following JVM parameters for anyone interested: -XX:+CMSClassUnloadingEnabled -XX:+UseParallelOldGC -XX:ParallelGCThreads=8 You can look up their definitions. Now I am golden!!! -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/ArrayIndexOutOfBounds-when-calling-addKnowledgePackage-tp837841p838712.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] removeKnowledgePackage Call Hangs!!
Thanks for the post Thomas. Actually, I wanted to load and unload KBs WHILE I am running the rules. That was not a problem at all, and it is not a problem with many other KBs. I was inspired by your post (so thank you very much) and started looking to maybe externalizing the removal from the rules themselves, however, I accidentally came across the fix!! I found out that as long as you keep the stateless session active across engine runs, it is a problem with the unloading (and again unloading ONLY sometimes with some packages). So, I disposed of the session at the end of every execution (which is something I probably should do anyways with a stateless session) and recreated one from the KnowledgeBase when I execute the rules again. This works like a charm!!! Now, I am able to load and unload package from within the rules themselves during execution. That fixed it! Thanks Thomas again for the inspiration that led me to the answer. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p827616.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] removeKnowledgePackage Call Hangs!!
Any help is appreciated. I am stuck on this. I stripped everything down to two simple drls, and one of them loads the other as a new KP, and then tries to unload it. Any ideas why the removeKnowledgePackage could possibly throw a NullPointerException in M1?? This is really hurting us as we are going live with this in a couple of weeks or so. Any help would be greatly appreciated! -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p824494.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] removeKnowledgePackage Call Hangs!!
OK. So, I did an isolated test, and only tested two KP including this bad one. Both packages have their complete set of rules. But now, the other package is able to remove this faulty one. So, it is when I had my complete set of KPs (about 10 of them) all active, and then attempted to remove this faulty one that is when I got the exception. By the way, I caught the exception in my application and moved on, so it is definitely not hanging. I hope this serves as a good hint to what is happening. It will take me some time to go through my KP to find the faulty rule or package. Any ideas what could cause this error? Apparently this KP that refuses to unload, did unload in my isolated example (in the same application/code). So, what could be the problem? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p817617.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] removeKnowledgePackage Call Hangs!!
I am trying to unload a KnowledgePackage that is already loaded in my KnowledgeBase. The call: this.knowledgeBase.removeKnowledgePackage(knowledgePackage.getName()); hangs (never returns). I had a similar problem with adding a KnowledgePackage to a KnowledgeBase and someone on here suggested that there was a synchronization problem in the internal implementation of the add method in the KnowledgeBase class, and that problem went away when I downloaded M1 files (from Feburary 10th of this year). However, I just got to test the removing of the KnowledgePackage and I seem to have a similar problem (?). Here is my unload rule: rule MyRule 1.0 when mpr : MyObject() eval(mpr.isKnowledgeBaseLoaded(ACTIVE_KP)) then mpr.print(Rule MyRule 1.0 Executed); mpr.removeKnowledgeBase(ACTIVE_KP); end The statement Rule MyRule 1.0 Executed is printed, and I am able to debug the code all the way to the line outlined above, and that is when it goes in a black hole. Any ideas why this is happening? Is this something fixed in M2? Here is the log: INFO|11904/0|10-05-13 13:19:54|Exception in thread Thread-5 org.drools.runtime.rule.ConsequenceException: rule: MyRule 1.0 INFO|11904/0|10-05-13 13:19:54| INFO|11904/0|10-05-13 13:19:54| at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) INFO|11904/0|10-05-13 13:19:54| at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:981) INFO|11904/0|10-05-13 13:19:54| at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:918) INFO|11904/0|10-05-13 13:19:54| at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1130) INFO|11904/0|10-05-13 13:19:54| at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:739) INFO|11904/0|10-05-13 13:19:54| at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:705) INFO|11904/0|10-05-13 13:19:54| at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:200) INFO|11904/0|10-05-13 13:19:54| at com.medcpu.mpu.pp.engine.Drools.fireRules(Drools.java:459) INFO|11904/0|10-05-13 13:19:54| at com.medcpu.mpu.MpuExecutor.executeRules(MpuExecutor.java:191) INFO|11904/0|10-05-13 13:19:54| at com.medcpu.mpu.MpuExecutor.initiateRuleExecution(MpuExecutor.java:431) INFO|11904/0|10-05-13 13:19:54| at com.medcpu.mpu.MpuExecutor.propertyChanged(MpuExecutor.java:147) INFO|11904/0|10-05-13 13:19:54| at com.medcpu.mpu.MpuExecutor.run(MpuExecutor.java:498) INFO|11904/0|10-05-13 13:19:54| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) INFO|11904/0|10-05-13 13:19:54| at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) INFO|11904/0|10-05-13 13:19:54| at java.lang.Thread.run(Unknown Source) INFO|11904/0|10-05-13 13:19:54|Caused by: java.lang.NullPointerException INFO|11904/0|10-05-13 13:19:54| at org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:369) INFO|11904/0|10-05-13 13:19:54| at org.drools.common.BaseNode.remove(BaseNode.java:95) INFO|11904/0|10-05-13 13:19:54| at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:237) -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p815616.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.1M2 Issue: LeftTupleSinkUpdateAdapter onlys supports assertLeftTuple
I will do that. I am just swamped right now with our production deployment and fixing all the issues I am having. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/5-1M2-Issue-LeftTupleSinkUpdateAdapter-onlys-supports-assertLeftTuple-tp813423p815631.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] removeKnowledgePackage Call Hangs!!
I found out one more thing, this call above consistently happens with that rule and the package it is unloading. I checked another rule that unloads another package and it works consistently fine. What could be the problem? I am assuming that if there are threads launched by Drools to execute rules that that would be taken into account by Drools' removeKnowledgePackage correct? So, there shouldn't be a deadlock. So, something is causing that call to hang on that package, but not on another package. Anybody has any idea where I can look for a possible solution or even where to start looking? Thanks. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p815767.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] removeKnowledgePackage Call Hangs!!
Again, there is probably no deadlock because if you look at the bold part of the stack trace I posted in the first post (and again below), it seems like it is throwing a NullPointerException and it is somehow killing the thread without returning back to my application (from Drools). Here are my findings: 1. It is throwing a NullPointerException (at org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:369 ). 2. The thread that threw the exception (Thread-15) check the logs below, disappeared from my list on JConsole (it is not displayed in the list of threads) which tells me that it was destroyed by an error that was later sucked in by another code in the stack and the call never returned to my application. Exception in thread Thread-15 org.drools.runtime.rule.ConsequenceException: ru le: MyRule 1.0 at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handl eException(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:981 ) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:918) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1130) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingM emory.java:739) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingM emory.java:705) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKno wledgeSessionImpl.java:200) at com.medcpu.mpu.pp.engine.Drools.fireRules(Drools.java:459) at com.medcpu.mpu.MpuExecutor.executeRules(MpuExecutor.java:191) at com.medcpu.mpu.MpuExecutor.initiateRuleExecution(MpuExecutor.java:431 ) at com.medcpu.mpu.MpuExecutor.propertyChanged(MpuExecutor.java:147) at com.medcpu.mpu.MpuExecutor.run(MpuExecutor.java:498) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source ) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:369 ) at org.drools.common.BaseNode.remove(BaseNode.java:95) at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:237) at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:413) at org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:7 29) at org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.jav a:657) at org.drools.impl.KnowledgeBaseImpl.removeKnowledgePackage(KnowledgeBas eImpl.java:166) at com.medcpu.mpu.pp.engine.Drools.removeKnowledgeBase(Drools.java:482) -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p815979.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] 5.1M2 Issue: LeftTupleSinkUpdateAdapter onlys supports assertLeftTuple
Hello, Did anyone have an issue with the latest M2 files? I just decided to try them out and upon trying to fire my first set of rules (which worked perfectly with M1 from 02/10/10), I get the following exceptions on this line: ksession.update(factHandle, myObject); Any ideas? java.lang.UnsupportedOperationException: LeftTupleSinkUpdateAdapter onlys supports assertLeftTuple method calls INFO|12572/0|10-05-12 15:20:50| at org.drools.reteoo.EvalConditionNode$LeftTupleSinkUpdateAdapter.retractLeftTuple(EvalConditionNode.java:460) INFO|12572/0|10-05-12 15:20:50| at org.drools.reteoo.ModifyPreviousTuples.retractTuples(ModifyPreviousTuples.java:101) INFO|12572/0|10-05-12 15:20:50| at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:177) INFO|12572/0|10-05-12 15:20:50| at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1389) INFO|12572/0|10-05-12 15:20:50| at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1285) INFO|12572/0|10-05-12 15:20:50| at org.drools.impl.StatefulKnowledgeSessionImpl.update(StatefulKnowledgeSessionImpl.java:248) INFO|12572/0|10-05-12 15:20:50| at com.medcpu.mpu.pp.engine.Drools.updateWorkingMemory(Drools.java:524) -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/5-1M2-Issue-LeftTupleSinkUpdateAdapter-onlys-supports-assertLeftTuple-tp813423p813423.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Classloader Leak?
I did this, and it did not do anything differently (still loading almost 1500 classes again for each new KnowledgeBase): KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,this.getClass().getClassLoader()); knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig); Anyone? Bueller? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Leak-tp784678p787521.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Classloader Leak?
Thanks for the reply. I still don't understand how you would resolve this issue of ever increasing number of classes in memory. Do you expect only one KnowledgeBase to be created per application? Also, so there is no way around this? Or, am I just screwed for using multiple KnowledgeBases? Thank. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Leak-tp784678p788171.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools Classloader Leak?
Hello, I noticed (using JConsole) that my application keeps loading more and more classes. I have over 105K classes loaded! I did a lot of debugging and isolation until I found the line that brings the number of classes loaded from 20K to 105K. It is this line: this.knowledgeBase.addKnowledgePackages(packages); packages is an array list of 8 DRLs that are compiled successfully. I am calling the line above exactly 99 times. However, I do have 99 instances of this.knowledgeBase. So, I have a total of 99 instances of knowledgeBase, and each instance is called once (line above) with 8 successfully compiled DRLs. I am starting to think that each instance of a KnowledgeBase somehow uses its own Classloader? Do I need to manually get the current application Classloader and pass it on to each instance of KnowledgeBase to ensure that no classes are loaded more than once? Is this a leak in the Classloader that comes inside the KnowledgeBase.addKnowledgePackage method? I did post somewhere else about delays on the line above, and no wonder it sometimes takes a couple of seconds to execute that line (the largest rules file I have is 150 KB with no more than 100 rules) if it creates a new Classloader and loads the same loaded classes AGAIN. Any insights on this? P.S. I did a search on the forum and couldn't find anything related to this. If you have better searching skills and found a post in that regards, please kindly point me to it. This is a very important issue as we are going to a live production environment in 3 weeks and I am not too happy with the performance, specifically around the line above. Thank you, and have a great weekend. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Leak-tp784678p784678.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] addKnowledgePackages Delay
Hello, I am trying to add knowledge packages to an existing KnowledgeBase. My largest DRL file has 110 rules. I noticed that it may take up to 5 seconds just to execute the following statement: this.knowledgeBase.addKnowledgePackages(packages); where packages is just a list of one knowledge package representing one drl. The nature of my rules is that I initially load a small set of rules and then at runtime my rules may load other DRLs. The problem is each DRL loading command (this.knowledgeBase.addKnowledgePackages(packages)) takes a few seconds and I have no idea why. Although, all those DRLs are already compiled (at startup time). It is the line I pasted above that takes the longest time out of anything else I do. Any idea why just merely adding a KnowledgePackage list to a KnowledgeBase can take this much time? Do you guys have any suggestions on how I can reduce this time? I tried to create another dummy KnowledgeBase and get the KnowledgePackage from it at runtime and add that to my KnowedgeBase above (thinking that would reduce the time maybe), but not at all. Any ideas would be great. The API does not have much info on what that add method exactly does behind the scenes, and how I can get around the long delays. This is very frustrating to me, and I am not sure where to look. Thanks for ANY help at all. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/addKnowledgePackages-Delay-tp772574p772574.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Inheritance-Like Design Question
Hello, I know, from searching this forum and posting before, that the concept of inheritance does not exist today in Drools. However, I have a need for it. Here is my specific situation: I have certain rules that have some generic conditions to be fired: Rule 1 If A Then X end Rule 2 If A, B Then Y end What I would like to do is, if Rule 2 is true, then I don't want Rule 1 to execute. I have many and many of those rules, so combining all the conditions in less number of rules violates our design having rules being mutually exclusive. That is why I wanted to include this behavior as a natural inheritance behavior rather than forcing the flow with logic inside the rule itself (you will make rules aware of others this way). So, since there is not built-in feature that allows you to do that, do people suggest anything that I can do without having to mix Rule 1 and Rule 2 into one rule with complex conditional statements? Any ideas? The only thing I can think of is taking this logic processing outside of drools, which is something that I am not too excited about. Thanks. -- View this message in context: http://n3.nabble.com/Inheritance-Like-Design-Question-tp430848p430848.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to create nested rules in Drool Guvnor
If such capability is not available, what is the best approach to override rules for specific clients? I cannot think of any way around this but to duplicate the rules for clients with overriden behavior and then have some Java logic to determine which knowledge package to load. Any ideas anyone on what is the best approach to do this? Michael Neale wrote: There was some work done to inherit LHS conditions from a certain named category - but that seems diferent to what Michael described.. I am confused too. (and from what I remember, it was an attribute, not in the header, but this might be a new experimental thing?). On Fri, Jan 8, 2010 at 7:49 AM, malkhafaji moe.alkhaf...@medcpu.com wrote: Marc Dzaebel wrote: Correction: extends works but is obviously undocumented. It adds the when part of the extended rule. Is the support for this keyword removed from the current version (in trunk)? This is the first time I am trying to use 'extends' in my rules but I cannot find ANYTHING in the documentation about it, and I have spent at least an hour searching this forum about it and it seems like everybody is saying that it should work to just do: rule Rule 2 when blah then blah end rule Rule 1 extends Rule 2 when blah then blah end But eclipse does not recognize extends as a valid keyword. Am I missing something? -- View this message in context: http://n3.nabble.com/How-to-create-nested-rules-in-Drool-Guvnor-tp61446p113101.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Michael D Neale home: www.michaelneale.net blog: michaelneale.blogspot.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://n3.nabble.com/How-to-create-nested-rules-in-Drool-Guvnor-tp61446p114674.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Eclipse Bug?
Hello, I just want to report something that I have seen, and I am not sure whether others see the same thing or not. I am using the latest binaries from TRUNK as well as drools library for Eclipse. I found out that if you comment a bunch of rules using /* through the end of the rules file (drl) but forgot to add a matching */ the rule does not complain on Eclipse no matter how many times I refresh, clean the project or restart eclipse. However, it correctly complains when I compile the run via the API that there is a mismatch '' and it points me to the last line of the file where the matching */ should have been. It does not give you an informative message, that is why I was puzzled for a while why it was pointing me to an empty line at the end of the drl file although Eclipse did not show any errors in the rules file. But then I noticed the color difference of how the rules are displayed and I knew that there was a beginning comment symbol somewhere. I just wanted to report this if people are having the same issue. -- View this message in context: http://n3.nabble.com/Eclipse-Bug-tp109772p109772.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users