CompositiveClassLoader$CachingLoader$load method intermittently hangs
by mikerod
I cannot easily reproduce an issue that I'm seeing. This is an intermittent
issue that happens probably 3% of the time or less.
This is observed behavior in
* Drools v5.6.0.Final, using
* Janino compiler v2.5.16 && transitively Drools brings
* mvel2 v2.1.8.Final
We have an environment that loads around 10 different KnowledgeBases into a
list.
Then one-by-one a single StatefulKnowledgeSession is created for a single
KnowledgeBase, facts are inserted, and then fireAllRules is called.
Every so often, we noticed that we were getting what seemed to be ininite
looping behavior for during either insertion time or fireAllRules time.
When we subsequently re-run the *same* session with the *same* KnowledgeBase
and the *same* facts inserted, it was successful and finished in
milliseconds (the average for our successful runs). We have repeatedly seen
this behavior of 1 failure, followed by a re-run that is successful.
We were able to attach a profiler to several of these hung sessions to
determine what was happening. It turns out that in both the scenario where
we saw a hang up on fact insertion and on fireAllRules call, the thread dump
was the same.
The stack looks like:
```
"main" - Thread t@1
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.getEntry(HashMap.java:347)
at java.util.HashMap.containsKey(HashMap.java:335)
at
org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:244)
at
org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237)
at
org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
org.mvel2.ParserConfiguration.checkForDynamicImport(ParserConfiguration.java:163)
at
org.mvel2.ParserConfiguration.hasImport(ParserConfiguration.java:191)
at org.mvel2.ParserContext.hasImport(ParserContext.java:360)
at org.mvel2.ParserContext.isVariableVisible(ParserContext.java:715)
at
org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:394)
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:250)
at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
at org.mvel2.MVEL.compileExpression(MVEL.java:810)
at
org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:417)
at
org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:238)
at
org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:224)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:208)
at
org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:175)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:133)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:302)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:254)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:366)
at
org.drools.common.SimpleBeliefSystem.insert(SimpleBeliefSystem.java:38)
at
org.drools.common.TruthMaintenanceSystem.addLogicalDependency(TruthMaintenanceSystem.java:207)
at
org.drools.common.TruthMaintenanceSystem.addLogicalDependency(TruthMaintenanceSystem.java:179)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:247)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:950)
at
org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:263)
at
org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:228)
at
org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:223)
<application-stack>
at some.drools.generated.rule.package.Rule_<drools-generated2>
at some.drools.generated.rule.package.Rule_<drools-generated1>
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1282)
- locked <656dd9a0> (a org.drools.common.DefaultAgenda)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1216)
- locked <656dd9a0> (a org.drools.common.DefaultAgenda)
at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1451)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:756)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:718)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
<facts-inserted-previously>
```
We were able to get the same hung thread dump prior to fireAllRules. I
think the related entry point is during one of the #assertObject calls
midway through the stack.
The CompositiveClassLoader$CachingLoader definitely seems to be the issue.
When we found this behavior consistently occurring (although rare), I found
the option of turning off the use of the caching loader by setting the
"drools.classLoaderCacheEnabled"="false" option referenced in the
ClassLoaderCacheOption class.
With this setting, we have done extensive retries to find this behavior and
it has vanished.
This CompositiveClassLoader$CachingLoader uses an internal j.u.HashMap that
is not safe for concurrent access. I have listed below several related
posts on the topic. I'm fairly sure if this used a j.u.c.ConcurrentHashMap,
this hanging thread scenario would not happen.
However, most of the posts I've seen on this subject are from use-cases
where the application is explicitly doing some sort of multithreaded access
to the Drools
KnowledgeBase and/or StatefulKnowledgeSession.
In my case, I do not know of *any* multithreaded actions taking place within
my application around the Drools KnowledgeBase or StatefulKnowledgeSession.
I am not seeing ConcurrentModificationException though. Instead I'm seeing
a, seemingly infinite, loop in the j.u.HashMap#getEntry.
Hanging in a "get" method of the j.u.HashMap would suggest to me that there
is a race condition where sometimes the j.u.HashMap#put on
the `classLoaderResultMap` field in the
CompositiveClassLoader$CachingLoader#load method is being executed at the
same time as another thread is doing the
j.u.HashMap#getEntry. If the j.u.HashMap were to resize at this point, it
could cause an infinite looping behavior.
Does Drools internally use multithreading? Is there somewhere in the MVEL
lib or the Janino compiler where it may be concurrently accessing the
CompositiveClassLoader$CachingLoader$load method?
I have been digging around a lot and I cannot find what could be the root
cause of this behavior.
I think this relates directly to these:
* http://lists.jboss.org/pipermail/rules-users/2013-July/032446.html
* http://lists.jboss.org/pipermail/rules-users/2013-July/032446.html
However, I do not see a real resolution to the problem.
I also see several related issues:
* http://lists.jboss.org/pipermail/rules-users/2013-July/032446.html
* https://issues.jboss.org/browse/JBRULES-3552
--
View this message in context: http://drools.46999.n3.nabble.com/CompositiveClassLoader-CachingLoader-lo...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Efficiency questions about DSL
by mfalaize
Hi,
I was wondering how to use efficiently DSL with my rules and I have several
questions about it :
- First, I have the impression that we can use DSL files only in the same
package of the DSLR file. When I tried to load DSL files by the kmodule.xml
(specifying the different packages in the packages attribute of kbase) it
does not work. Do I have to load each DSL files programmatically or is there
a way to load it automatically by the kmodule.xml (and if it is the case,
how can we handle the parsing order of these files ?) ?
- An underlying question is is this a good practice to divide DSL files ? I
would like to translate all my rules in french and to put the generic
translations in a unique DSL file to reuse it in all of my different DSLR
files.
- I noted that we can use more than one DSL file for one DSLR file (it works
at the runtime) but when it is the case the DRL viewer of the DSL rule
editor does not work and I don't have autocompletion. I tried to put several
expander instructions but it fails. Is there a way to make it work ?
I think DSL stuff is underestimate at this moment by the community and for
my last question I would like to know what is the future plans about this
feature ? Maybe I could help to develop it.
Regards
--
View this message in context: http://drools.46999.n3.nabble.com/Efficiency-questions-about-DSL-tp402877...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Drools 6 support for changeset
by wtang
I have a requirement in which when a rule is changed, the change needs to be
reflected immediately without retarting the system.
In Drools 5.x we can use the changeset.xml with the knowlegde agent. Now in
Drool 6.0 we have Kie API.
1) does Kie support changeset.xml?
2) Upper management don't want to use kie, they want to use jsr94. Does
jsr94 support changeset.xml?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-support-for-changeset-tp402713...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
part time intern @ Red Hat
by Mark Proctor
I have a small budget for a part time intern for one year, 12K USD. The work can be 100% remote, from almost any country. This will mostly be UI work, improving our workbench.
If this interests you, email me off list.
Mark
11 years, 10 months
Drools Planner: what if possible values of a PlanningVariable are dependent of another one?
by Willem van Asperen
Hi All,
I have a PlanningEntity that has several planning variables, say A and
B. Now, if A is O then B can be X or Y and when A is P then B can be Y or Z.
I see two routes:
* create a solution property that generates X, Y and Z as alternatives
for B and rely on the score rules to dismiss improper values,
depending on the value of A
* create an entity property that only generates the possible values
for B (i.e. X,Y for A=O and Y,Z for A=P)
What is the best route?
(Alternatively I do not use the constructionHeuristic and just start of
my solution with a randomly (but correct) generated solution)
Regards,
Willem
11 years, 10 months
OptaPlanner scalability
by Rupesh M G
Hi,
I tested Optaplanner successfully for a fleet planning application.
Upto 1200 trips with around 80 vehicles for 3 days is fine.
I'm reaching the target of 0 hard constraints in less than 30 minutes.
But my target is to plan for a month with 12000 trips using 80 vehicles.
This time it didn't complete even after 12 hours.
I found the memory (< 500 MB) and CPU (25%) usage is less.
So tried running 3 solver threads and grouping the vehicles.
Now CPU usage increases.
I followed the vehicle routing sample application and the config xml is very similar.
I used late acceptance (200) and accept count (1000).
I'm using incremental score calculation; and applied change & swap filters in the config xml.
Requesting experts for some thoughts on how Optaplanner can scale on similar situations.
Thanks & Regards,
Rupesh
DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."
11 years, 10 months
Spring, KnowledgeAgent, and Guvnor
by paulB
I'm having a problem connecting my KnowledgeAgent to a package in Guvnor.
I'm using Spring to instantiate the KnowledgeAgent. The agent initializes
perfectly well when I point to a local change-set that in-turn points to a
local rule. However, even though I have the same rule in a package in
Guvnor, the KnowledgeAgent fails with the following exception when I point
to the package's change-set in Guvnor:
The code at KnowledgeBaseImpl.java:148 is (using 5.3.0.Final):
Here is the simple rule in the Guvnor as returned by the URL for the package
source URL:
Here is the local change-set definition. The line that is commented is the
failing resource, whereas the local file resource works fine:
Guvnor is residing on a Tomcat server.
I could not find anything related to this on the forum. Thank you for any
hints.
-Paul
--
View this message in context: http://drools.46999.n3.nabble.com/Spring-KnowledgeAgent-and-Guvnor-tp3500...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months