[
https://issues.jboss.org/browse/DROOLS-1103?page=com.atlassian.jira.plugi...
]
Juan Carlos Garcia commented on DROOLS-1103:
--------------------------------------------
No i don't, just to mention my setup:
We create thousands of StatefulKnowledgeSession session per hour as each of them
correspond to a gaming session between few users (besides regulars game rules, we also
have timer rules to control certain aspect as timeout, disconnect, ect), so once a game if
finished we received a message to close the game (if we don't get the appropriate
message we have some Janitors kicking in every 5 / 10 minutes and disposing the Sessions
that are still in our SessionStore (ConcurrentMap on a Singleton EJB) and haven't
received events from customers) and we disposed our StatefulKnowledgeSession in order to
be good citizens.
In order to mitigate that exception we are now Serializing user access, per game to the
StatefulKnowledgeSession thru our own locking.
I check today and we had only one of this exception in the past 15 days (but looks little
bit different). as it is coming from a timer being triggered directly and not from
FireAllRules scenario.
{code}
_ThreadID=21899;_ThreadName=pool-116731-thread-1;_TimeMillis=1467642563388;_LevelValue=900;|
Unable to execute timer job!
java.util.concurrent.RejectedExecutionException: Task
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@60560a44 rejected
from java.util.concurrent.ScheduledThreadPoolExecutor@7671ec29[Shutting down, pool size =
1, active threads = 1, queued tasks = 0, completed tasks = 6]
at
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
at
java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:326)
at
java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:549)
at org.drools.core.time.impl.JDKTimerService.internalSchedule(JDKTimerService.java:116)
at org.drools.core.time.impl.JDKTimerService.scheduleJob(JDKTimerService.java:99)
at org.drools.core.phreak.PhreakTimerNode.scheduleTimer(PhreakTimerNode.java:307)
at org.drools.core.phreak.PhreakTimerNode.scheduleLeftTuple(PhreakTimerNode.java:230)
at org.drools.core.phreak.PhreakTimerNode.doLeftInserts(PhreakTimerNode.java:108)
at org.drools.core.phreak.PhreakTimerNode.doNode(PhreakTimerNode.java:83)
at org.drools.core.phreak.RuleNetworkEvaluator.evalNode(RuleNetworkEvaluator.java:400)
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:332)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166)
at org.drools.core.phreak.AddRemoveRule.forceFlushLeftTuple(AddRemoveRule.java:320)
at
org.drools.core.phreak.AddRemoveRule.flushLeftTupleIfNecessary(AddRemoveRule.java:293)
at org.drools.core.reteoo.BetaNode.assertObject(BetaNode.java:294)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:494)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:384)
at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:494)
at
org.drools.core.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:384)
at org.drools.core.reteoo.ObjectTypeNode.propagateAssert(ObjectTypeNode.java:298)
at org.drools.core.phreak.PropagationEntry$Insert.execute(PropagationEntry.java:93)
at
org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:96)
at
org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:69)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.flushPropagations(StatefulKnowledgeSessionImpl.java:1993)
at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:128)
at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:78)
at
org.drools.core.phreak.PhreakTimerNode$TimerAction.evaluateAndFireRule(PhreakTimerNode.java:439)
at org.drools.core.phreak.PhreakTimerNode$TimerAction.execute(PhreakTimerNode.java:431)
at
org.drools.core.phreak.SynchronizedPropagationList$1.execute(SynchronizedPropagationList.java:39)
at org.drools.core.common.DefaultAgenda.executeTask(DefaultAgenda.java:1355)
at
org.drools.core.phreak.SynchronizedPropagationList.addEntry(SynchronizedPropagationList.java:36)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.addPropagation(StatefulKnowledgeSessionImpl.java:1989)
at
org.drools.core.phreak.PhreakTimerNode$TimerNodeJob.execute(PhreakTimerNode.java:375)
at org.drools.core.time.SelfRemovalJob.execute(SelfRemovalJob.java:34)
at
org.drools.core.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:69)
at
org.drools.core.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
{code}
FireAllRules can trigger
java.util.concurrent.RejectedExecutionException from the JDKTimerService
-------------------------------------------------------------------------------------------------
Key: DROOLS-1103
URL:
https://issues.jboss.org/browse/DROOLS-1103
Project: Drools
Issue Type: Bug
Affects Versions: 6.3.0.Final
Reporter: Juan Carlos Garcia
Assignee: Mario Fusco
Under very rare circumstance we have found the following exception
*java.util.concurrent.RejectedExecutionException* in our production log.
Our guess is that the Drools Session is on its way to be dispose, while a new incoming
request is in the middle of a fireAllRules operation (race condition).
I will try to provide a reproducible testcase for this.
{code}
Caused by: java.util.concurrent.RejectedExecutionException: Task
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@3e896443 rejected
from java.util.concurrent.ScheduledThreadPoolExecutor@71cc2f4c[Terminated, pool size = 0,
active threads = 0, queued tasks = 0, completed tasks = 0]
at
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
at
java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:326)
at
java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:549)
at
org.drools.core.time.impl.JDKTimerService.internalSchedule(JDKTimerService.java:118)
at
org.drools.core.time.impl.JDKTimerService.scheduleJob(JDKTimerService.java:101)
at
org.drools.core.phreak.PhreakTimerNode.scheduleTimer(PhreakTimerNode.java:304)
at
org.drools.core.phreak.PhreakTimerNode.scheduleLeftTuple(PhreakTimerNode.java:233)
at
org.drools.core.phreak.PhreakTimerNode.doLeftUpdates(PhreakTimerNode.java:131)
at org.drools.core.phreak.PhreakTimerNode.doNode(PhreakTimerNode.java:65)
at
org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:357)
at
org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
at
org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:194)
at
org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:67)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:935)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1200)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:957)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:936)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:260)
at XXXXXX.XXXXX.XXXXX.processEventDrools(EventProcessorImpl.java:128)
at XXXXXX.XXXXX.XXXXX.processEvent(EventProcessorImpl.java:101)
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)