Winfried Umbrath created JBRULES-3700:
-----------------------------------------
Summary: Deadlock between AbstractWorkingMemory and DefaultAgenda in Fusion
Key: JBRULES-3700
URL:
https://issues.jboss.org/browse/JBRULES-3700
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (fusion)
Affects Versions: 5.5.0.Final
Reporter: Winfried Umbrath
Assignee: Mark Proctor
I experienced a deadlock when running in STREAM mode and using negative patterns with
temporal constraints.
When the rule gets fired by the installed timer job and at the same time another thread is
firing rules, a deadlock can occur:
1. [rule firing thread]
StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:820)
acquires lock in AbstractWorkingMemory
2. [timer-thread] DefaultAgenda.fireActivation()
call of synchronized method
3. [rule firing thread] DefaultAgenda.fireActivation()
synchronized method, wait for other thread to exit synchornized method
4. [timer-thread] AbstractWorkingMemory.getGlobal()
tries to access a global, tries to acquire lock in AbstractWorkingMemory which is held by
the other thread
--> Deadlock
Excerpt from thread dump:
"http-thread-pool-8082(374)":
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1264)
- waiting to lock <0x00007f50407e4950> (a org.drools.common.DefaultAgenda)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:679)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:234)
at
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:102)
at
org.drools.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:32)
at
org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155)
at
org.drools.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76)
at
org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:821)
"pool-4251-thread-1":
at sun.misc.Unsafe.park(Native Method)
- parking to wait for 0x00007f503fc71a20> (a
java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:778)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1114)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:186)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262)
at org.drools.common.AbstractWorkingMemory.getGlobal(AbstractWorkingMemory.java:634)
at
myrules.Rule_ruleWithTimeout_ece4a3c9fc2741a4ab97a92b77611203DefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
- locked <0x00007f50407e4950> (a org.drools.common.DefaultAgenda)
at org.drools.common.DefaultAgenda.fireTimedActivation(DefaultAgenda.java:1344)
- locked <0x00007f50407e4950> (a org.drools.common.DefaultAgenda)
at org.drools.common.Scheduler$ActivationTimerJob.execute(Scheduler.java:83)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira