DuncanDoyle / drools-incremental-update

11 stars 10 forks source link

Drools 6.3.0.Final #1

Open lindsaythurmond opened 8 years ago

lindsaythurmond commented 8 years ago

Any chance you are going to update this to work with Drools 6.3.0.Final? I attempted on my own but am having trouble getting past some null pointers that it throws when you update. For example running KieSessionRulesIncrementalUpdateAddedRulesTest#testAddedRulesDifferentDrl() gives a stacktrace like the following:

java.lang.NullPointerException
    at org.drools.core.reteoo.NodeTypeEnums.isBetaNode(NodeTypeEnums.java:88)
    at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:254)
    at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166)
    at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:123)
    at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:194)
    at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:73)
    at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:978)
    at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1292)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1294)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1281)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1260)
    at org.jboss.ddoyle.drools.demo.KieSessionRulesIncrementalUpdateAddedRulesTest.testAddedRulesDifferentDrl(KieSessionRulesIncrementalUpdateAddedRulesTest.java:125)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
DuncanDoyle commented 8 years ago

Yes, I can definitely do that. One question though, is that NPE thrown when using the rules in my example or are you using your own rules? We've recently fixed a number of bugs in Drools incremental update on master (Drools 6.4.0-SNAPSHOT) which have also been backported to the Drools 6.3.x branch.

lindsaythurmond commented 8 years ago

I used the rules in your example with no changes other than the following properties in the pom.

<properties>
    <version.org.kie>6.3.0.Final</version.org.kie>
    <version.org.kie.test>6.3.0.Final</version.org.kie.test>
    <version.org.mvel>2.2.7.Final</version.org.mvel>
</properties>
DuncanDoyle commented 8 years ago

I've tested with Drools 6.3.0.Final and that indeed shows the NPE, and also a ClassCastException. I did expect that CCE, as we've solved that in 6.3.1-SNAPSHOT and 6.4.0-SNAPSHOT. However, the NPE still occurs on 6.4.0-SNAPSHOT as well.

The tests that fail are the tests in which I change the name of the .drl file on incremental update. In a real system, I would not recommend changing .drl filenames on incremental update anyway. Nevertheless, Drools should not throw an NPE when one does.

The other tests that fail seem to fail due to the new propagation queue implemented in Drools, which slightly changes when a rule is fired. So I think that's a problem in my unit-test assertions which I need to fix.

I'll create a small reproducer for the NPE, open a JIRA against Drools and discuss it with the Drools core engineers. I'll post the link to the JIRA here so you can track it. I'll also investigate the failing assertions and fix them.

DuncanDoyle commented 8 years ago

https://issues.jboss.org/browse/DROOLS-965