我们已经使用Drools
设置了基本的Guvnor UI
框架。规则是由半技术人员编写的,并且存在错误范围(范围始终存在,无论是谁写的:))
昨天,有人编写了一条规则,开始抛出NullPoiterException
,但Drool似乎将此异常包装成CYCLIC_DEPENDENCY_ERROR并显示相同的内容。
此外,在此问题发生后,我们立即(3-4分钟)结束了OOM java.lang.OutOfMemoryError: Java heap space
。
Stacktrace了解详情:
Feb 2013 08:06:55,447 [ERROR] (SWF Activity DroolsActivityTaskList-2.2 229) com.amazon.mobius.csi.workers.droolsengine.DroolsEngineActivitiesImpl:runRules:220 [CYCLIC_DEPENDENCY_ERROR]: Error
while executing Rules, Please validate all rules against any cyclic dependency
Exception executing consequence for rule "final NON EC" in com.amazon.mobius.csi.workers.droolsengine: java.lang.NullPointerException
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:708)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:672)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:295)
at com.amazon.mobius.csi.workers.droolsengine.DroolsEngineActivitiesImpl.runRules(DroolsEngineActivitiesImpl.java:216)
at com.amazon.mobius.csi.workers.droolsengine.DroolsEngineActivitiesImpl.executeRules(DroolsEngineActivitiesImpl.java:145)
at sun.reflect.GeneratedMethodAccessor173.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.amazonaws.services.simpleworkflow.flow.pojo.POJOActivityImplementation.execute(POJOActivityImplementation.java:63)
at com.amazonaws.services.simpleworkflow.flow.generic.ActivityImplementationBase.execute(ActivityImplementationBase.java:46)
at com.amazonaws.services.simpleworkflow.flow.worker.SynchronousActivityTaskPoller.execute(SynchronousActivityTaskPoller.java:214)
at com.amazonaws.services.simpleworkflow.flow.worker.ActivityTaskPoller$2.run(ActivityTaskPoller.java:95)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at com.amazon.mobius.csi.workers.droolsengine.Rule_final_NON_EC.defaultConsequence(Unknown Source)
at com.amazon.mobius.csi.workers.droolsengine.Rule_final_NON_ECDefaultConsequenceInvoker.evaluate(Unknown Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 18 more
为什么Drools将其视为CYCLIC_DEPENDENCY并导致OOM?我们还有其他问题吗?任何帮助将不胜感激。
谢谢,
答案 0 :(得分:0)
我认为这是规则之间的循环依赖。一条规则的RHS正在激活另一条规则,而另一条规则的RHS又会激活第一条规则。因此,存在无限循环的规则激活。
如果没有看到规则本身,我建议设置一个议程事件监听器来记录触发的规则。这样你就应该能够看到以这种方式激活哪两条规则。这样的日志记录侦听器的示例如下: