[rules-users] Getting deadlock-like thread state

Bojan Janisch bojan.janisch at scai.fraunhofer.de
Tue Jul 23 08:33:42 EDT 2013


Hey drools users,

I'm running drools multiple times in parallel with ECJ (genetic algorithm framework). Also I'm running ECJ multiple times in parallel (evaluation purpose).
But each time I want to run ECJ, after an unspecific time, one thread is running infinite long while ECJ waits for it to finish. Additionally to this my 
working memory is steadily growing while hanging in this deadlock-like state, though this might not be due to drools. This goes on until I get an gc out of 
memory exception.

I've created a threaddump which always looks so:

 java.lang.Thread.State: RUNNABLE
	at java.lang.Object.notifyAll(Native Method)
	at org.drools.common.DefaultAgenda.notifyHalt(DefaultAgenda.java:1478)
	- locked <0x00002af5f3b0fe88> (a java.util.concurrent.atomic.AtomicBoolean)
	at org.drools.common.DefaultAgenda.addActivation(DefaultAgenda.java:466)
	at org.drools.common.DefaultAgenda.addActivation(DefaultAgenda.java:326)
	at org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:259)
	at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:196)
	at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:71)
	at org.drools.reteoo.JoinNode.propagateFromLeft(JoinNode.java:107)
	at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:95)
	at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:196)
	at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:71)
	at org.drools.reteoo.JoinNode.propagateFromLeft(JoinNode.java:107)
	at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:95)
	at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:196)
	at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:71)
	at org.drools.reteoo.JoinNode.propagateFromRight(JoinNode.java:159)
	at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:148)
	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:235)
	at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
	at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
	at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
	at rulevolution.RulEvolution.runDrools(RulEvolution.java:343)
	at rulevolution.RulEvolution.evaluate(RulEvolution.java:185)
	at ec.simple.SimpleEvaluator.evalPopChunk(SimpleEvaluator.java:259)
	at ec.simple.SimpleEvaluator$SimpleEvaluatorThreadCG.run(SimpleEvaluator.java:341)
	at ec.util.ThreadPool$PoolThread.run(ThreadPool.java:57)

   Locked ownable synchronizers:
	- <0x00002af5f3ae95d0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)

To my Programm:

Rules are generated in parallel and for each rule, a new KnowledgeBase, KnowledgeBuilder and StatefulKnowledgeSession is created. 
Objects are inserted into the session and the rule is fired. The session will be disposed after no facts matches my rule or 1000 
conclusions are fired. 

I've searched the net for a similar problem, but with no success. Does someone know why Drools get into such a thread state and 
how to get out of it? 

I appreciate any help.

Bojan


More information about the rules-users mailing list