[
https://issues.jboss.org/browse/DROOLS-766?page=com.atlassian.jira.plugin...
]
Dmitry Toptygin commented on DROOLS-766:
----------------------------------------
Maybe this will help with finding the root cause:
When TimeFact condition in the rule1 is modified to contain "always true
clause", like "id == (123 - 123)" - then the problem does not happen. This
is the workaround we're currently using.
Otherwise problem happens when TimeFact conditions in rule1 and rule2 are the same.
Note:
Problem happens after a couple of minutes of executing the reproducer code.
AlarmRecord fact and ClearEvent event are inserted externally into the rule engine working
memory while rule engine executes fireUntilHalt in streaming mode.
TimeFact has id of 0, it is updated externally to the rule engine via its FactHandle using
kSession.update
Below are rules with the workaround:
===
package rules
import org.example.infiniteloop.ClearEvent
import org.example.infiniteloop.TimeFact
import org.example.infiniteloop.AlarmRecord
declare org.example.infiniteloop.ClearEvent
@role( event )
@timestamp( eventTimestamp )
@expires( 20s )
end
rule "rule1"
when
TimeFact($currentTime : value, id == (123 - 123) ) //remove "id == (123 -
123)" to reproduce the infinite loop problem
ClearEvent()
$clientAlarm: AlarmRecord(createdTimestamp < $currentTime - 15000)
then
//System.out.println("rule 1 fired");
delete($clientAlarm);
end
rule "rule2"
when
TimeFact($currentTime : value)
$clientAlarm: AlarmRecord(createdTimestamp < $currentTime - 15000)
//any other condition will do here
Number(intValue == 42)
then
//not important
end
RuleNetworkEvaluator infinite loop when doUpdatesReorderLeftMemory is
called
----------------------------------------------------------------------------
Key: DROOLS-766
URL:
https://issues.jboss.org/browse/DROOLS-766
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 6.2.0.Final
Reporter: Juan Carlos Garcia
Assignee: Mario Fusco
Attachments: infiniteLoopReproducer.jar, infiniteLoopReproducer_src.jar
We are migrating our system to use drools 6.2.0.Final from 6.0.1.Final and one of our
testcase which actually simulate several complex scenario is making drools (6.2.0.Final)
going into an endless loop, while the same works fine in 6.0.1.Final.
I took a thread dump and it seems stuck:
{code}
at
org.drools.core.phreak.RuleNetworkEvaluator.doUpdatesReorderLeftMemory(RuleNetworkEvaluator.java:795)
{code}
While debugging the source code this is what i got:
# LeftTupleMemory ltm = bm.getLeftTupleMemory();
** LeftTupleMemory is a LeftTupleList
# leftTuple.getStagedNext();
** Always return the same object instance(leftTuple is a JoinNodeLeftTuple type), hence
the loop never ends.
Unfortunately i cannot provide the DRL files + domain classes involve and don't know
if it would be even possible for me right now to recreate the same testcase without
leaking internal information from the company i work for.
ThreadDump
{code}
"Attach Listener" daemon prio=10 tid=0x00007fdb74001000 nid=0x88c waiting on
condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"drools-worker-2" daemon prio=10 tid=0x00007fdb54003000 nid=0x803 waiting on
condition [0x00007fdb9b7cc000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000783f213f0> (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
"pool-3-thread-1" prio=10 tid=0x00007fdba46de000 nid=0x764 waiting on condition
[0x00007fdb9bbd6000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000783eba160> (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082)
at
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
at
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
"Service Thread" daemon prio=10 tid=0x00007fdba40ad800 nid=0x754 runnable
[0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" daemon prio=10 tid=0x00007fdba40ab000 nid=0x753 waiting on
condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0x00007fdba40a8000 nid=0x752 waiting on
condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"JDWP Command Reader" daemon prio=10 tid=0x00007fdb68001000 nid=0x74e runnable
[0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"JDWP Event Helper Thread" daemon prio=10 tid=0x00007fdba40a6000 nid=0x74d
runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"JDWP Transport Listener: dt_socket" daemon prio=10 tid=0x00007fdba40a2800
nid=0x74c runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" daemon prio=10 tid=0x00007fdba4094800 nid=0x74b runnable
[0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" daemon prio=10 tid=0x00007fdba4074800 nid=0x74a in Object.wait()
[0x00007fdba0cfb000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007838824e0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
- locked <0x00000007838824e0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler" daemon prio=10 tid=0x00007fdba4072800 nid=0x749 in
Object.wait() [0x00007fdba0dfc000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007838820a0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:503)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
- locked <0x00000007838820a0> (a java.lang.ref.Reference$Lock)
"main" prio=10 tid=0x00007fdba400e800 nid=0x743 runnable [0x00007fdbad9a8000]
java.lang.Thread.State: RUNNABLE
at
org.drools.core.phreak.RuleNetworkEvaluator.doUpdatesReorderLeftMemory(RuleNetworkEvaluator.java:795)
at org.drools.core.phreak.PhreakJoinNode.doNode(PhreakJoinNode.java:38)
at
org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:547)
at
org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:533)
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:334)
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:235)
- locked <0x0000000783f2da90> (a org.drools.core.phreak.RuleExecutor)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:106)
- locked <0x0000000783f2da90> (a org.drools.core.phreak.RuleExecutor)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1016)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1302)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1289)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1262)
at
org.drools.core.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:109)
at
org.drools.core.command.runtime.rule.FireAllRulesCommand.execute(FireAllRulesCommand.java:34)
at
org.drools.core.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:155)
at
org.drools.core.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:76)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:723)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:697)
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)