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
Drools and GPU
by Anton Hughes
Hi all
We have finding drools to be very resource hungry - and we are looking at
having to have very many servers just to satisfy our drools requirements.
So I am wondering, has anyone experimented with running drools on a GPU
server?
Thanks and regards
Anton
11 years, 9 months
newbie question about KnowledgeBuilder
by kenatnielsen
Hi,
I'm inheriting Drools 6.0 application where all rules are in one huge drl
file. Would behavior be different if I broke rules into multiple files and
loaded with multiple calls to KnowledgeBuilder.add()?
Also, KnowledgeBuilder is being created with each session:
KnowledgeBuilder.newKnowledgeBuilder() and then knowledgeBuilder.add().
Since rules don't change, any reason why can't create KnowledgeBuilder at
startup and share it? Is it thread safe and can it be re-used?
Thanks,
Ken
--
View this message in context: http://drools.46999.n3.nabble.com/newbie-question-about-KnowledgeBuilder-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 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, 10 months
Startup KIE Workbench without network connection
by Sandjaja, Dominik
Hello,
I try to setup KIE Workbench (6.1.0.BetaX) on Tomcat 7 on a Windows 2012 Server without connection to the internet.
When starting up, the KIE-WB does not start up. I get the following errors in localhost.log (cut for better readability):
Mai 15, 2014 5:08:18 PM org.apache.catalina.core.StandardContext listenerStart
Schwerwiegend: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions:
[...]
Caused by: java.lang.RuntimeException: https://github.com/guvnorngtestuser1/guvnorng-playground.git: cannot open git-upload-pack
[...]
Caused by: java.net.ConnectException: Connection time out: github.com
This happens because the initial demo repository is downloaded - I do not want and need those repositories!
I could work around this by copying the TOMCAT_HOME/bin/.niogit directory to that server and have it start up then.
BUT: IMHO it is an inconvenience, maybe even a bug, that an internet connection is needed to set up the Drools KIE Workbench. How are we supposed to tell our infrastructure team that we need an open connection to "some website with code" to setup an editing system for internal knowledge ...
Should I file a bug for that? Is there a way to deactivate the downloading of the initial demo repository? Could it somehow be delivered with the KIE-WB package?
Thanks
Dominik
...........................................................................
mit freundlichen Gr??en / kind regards
Dominik Sandjaja
Fon: +49 (0) 203 60878 183
Fax: +49 (0) 203 60878 222
e-mail: dominik.sandjaja(a)it-motive.de
it-motive AG
Zum Walkm?ller 6
47269 Duisburg
info(a)it-motive.de
http://www.it-motive.de
..............................................................................
Vorsitzender des Aufsichtsrats: Dr.-Ing. J?rgen Sturm
Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose
HRB 9207, Amtsgericht Duisburg
11 years, 10 months
Map<String,String> and modify() can't be together
by rjh
Hi,
I got a weird problem. A Java List/Map with generics can be used together
with modify() in the same rule. For example, a simple rule like the
following:
package com.sample
import java.util.Map;
import java.util.HashMap;
declare TestFact
@propertyReactive
data : String
end
rule "init"
when
not TestFact()
then
insert (new TestFact());
end
rule "Test Rule"
when
$fact : TestFact()
then
System.out.println( "Hello" );
Map<String,String> a = new HashMap<String,String>();
modify ($fact) {setData("0")}
end
I got the following error message:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1,
level=ERROR, path=rules/Sample.drl, line=18, column=0
text=Unable to resolve type Map<String,String>:
Unable to find class 'Map<String,String>']]
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:260)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:400)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:375)
at com.sample.DroolsTest.main(DroolsTest.java:17)
However, if I remove "<String,String>" from "Map<String,String>", or remove
the "modify" line, the code is correct then.
Thank you!
Jinghai
--
View this message in context: http://drools.46999.n3.nabble.com/Map-String-String-and-modify-can-t-be-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Newbie: is my data model suitable for drools ?
by lindenb
Hi all,
I'm working in the field of bioinformatics where I study more a large number
of variations (N> 10E6) along the human genome among individuals affected
by a genetic disease. ( * )
my data looks like this (much simplified !)
#CHROMOSOME POSITION GENE PROPERTIES SAMPLE1 SAMPLE2
SAMPLE3
chr1 987 GENE1,GENE3 score=1 null A/A A/G
chr1 988 GENE3 score=4;id=989 A/G null A/A
chr1 1988 null score=4;id=989 C/G null C/A
People in my lab have to filter those variation using different strategy,
they then extract the overlapping genes and then filter those genes to find
one or more gene that could explain the disease.
Currently they use knime.org to run those filters.
(http://www.myexperiment.org/workflows/2320.html )
But I've got the feeling that drools could be used to filter those
variations.
Users would 'just' have to write some rules, run the engine and get the
result.
Rules would be removed/switched to get the result for another strategy.
Question:
1) is drools a good choice here ?
2) how should I model my data ?
If I use this java model:
class Gene {
List<Variation> getVariations();
}
class Variation {
String getChromosome();
int getPosition();
List<Gene> getGenes();
List<Genotype> getGenotypes();
}
class Genotype{
Variation getVariation();
Sample getSample();
String getDNA();
}
it will create a large graph, can drools support it ?
3) Where in the documentation can I find how to easily set the state my
objects in order to filter them. E.g:
variations ->[filters1]-> [filter2]----------------->[fiilter5] -> result
`>[filter3]->[filter4]--/
Thank you,
Pierre
(*)
http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-vari...
--
View this message in context: http://drools.46999.n3.nabble.com/Newbie-is-my-data-model-suitable-for-dr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Deploy Rules in separate OSGi bundles
by Ephemeris Lappis
Hello.
I'd like to separate cleanly my Drools system into 2 OSGi bundles :
1) the java code that uses the Kie API (6.0.1) and exposes service
interfaces to the business part of the applications. Its code relies on
someting like :
KieServices kieServices = KieServices.Factory.get();
kieContainer = kieServices.getKieClasspathContainer();
KieSession kieSession = kieContainer.newKieSession(name);
2) the rules themselves, just including the kmodule.xml that manages the
ksessions and the drl files in their own packages.
Let say the first module is S and second is R, while the applcation is A.
This build model works nice in my eclipse with correct maven dependancies
set from A to both S and R. Classes in the application A calls the service
from the S. The kieContainer has resolved as expected the kmodule and
associated the rules files for the given packages, and the application can
get the ksession for a given name.
I'm afraid that the same code won't run as nice as it does when deployed on
my Karaf (Service MIX) OSGi environment. I suspect that the KieContainer may
encounter some troubles to detect the kmodule.xml in the META-INF and the
DRL files out of another jar.
Is there anyone with such experiences ?
Any advice to do it ?
Thanks in advance.
Regards.
--
View this message in context: http://drools.46999.n3.nabble.com/Deploy-Rules-in-separate-OSGi-bundles-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Drools 5.5 and Java 7 syntax
by Ephemeris Lappis
Hello.It seems that Drools 5.5 experiences problems translating RHS code with
Java 7 syntax, while it's running with JDK 1.7.For example, literal numbers
with thousand separator of form "*10_000*" are detected as errors, and
generics forms like *List l = new ArrayList<>()*; is also refused because of
the <> that must be removed.Is it a natural behavior or is there a way to
majke it use a Java 7 aware parser ?Thanks for your help.Regards.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-5-5-and-Java-7-syntax-tp4029588....
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months