[jboss-jira] [JBoss JIRA] (DROOLS-1742) NPE in RuleNEtworkEvaluator after incremental compilation
Mario Fusco (JIRA)
issues at jboss.org
Mon Sep 25 06:57:00 EDT 2017
[ https://issues.jboss.org/browse/DROOLS-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467817#comment-13467817 ]
Mario Fusco commented on DROOLS-1742:
-------------------------------------
[~hightea] I ran your project and reproduced the problem, thanks a lot for it. However I'm seeing that you're using internal test classes of drools and I just wanted to warn you that what's happening there is probably a bit different from what you expect or anyway it's different from what you wrote in the description of this issue.
The reason why you see 2 different behaviours in your apparently identical test cases is that in the working case you're indeed only removing one of the 2 rules, while in the failing one you're removing *both* rules and then *readding* one of them. This is because how that createJar method works internally ( see https://github.com/kiegroup/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/CommonTestMethodBase.java#L308 ). There it creates artificial names for drl files based on their position in the varargs. In the breaking case the drl file containing the rule that you want to keep is named r1.drl during first compilation and r0.drl during incremental one. Incremental compilation compares files content based on their names this means that it cannot do anything else than what I described. Note indeed that if you replace line 62 of your reproducer
{code}
createAndDeployJar( ks, releaseId2, DRL_PACKAGE_A);
{code}
with
{code}
createAndDeployJar( ks, releaseId2, null, DRL_PACKAGE_A);
{code}
the position (and then the name) of the file containing the rule that you want to keep is preserved and the test passes.
To recap, I'm not saying that we don't have a bug: we do and I'm about to start working right now to investigate and fix it. I just wanted to clarify that the situation when this bug shows up is slightly different and a bit more complex of what you described.
> NPE in RuleNEtworkEvaluator after incremental compilation
> ---------------------------------------------------------
>
> Key: DROOLS-1742
> URL: https://issues.jboss.org/browse/DROOLS-1742
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.3.0.Final
> Reporter: Théophane Charbonnier
> Assignee: Mario Fusco
> Attachments: drools-path-memory-reproducer.zip
>
>
> Having the following drl files :
> {code:drl}
> package org.hightea.a
> import org.drools.compiler.Message
> import org.drools.compiler.FirstClass
> rule "RG_1"
> when
> $event : Message()
> FirstClass(item1 == $event.message1)
> then
> System.out.println("RG_1");
> end
> {code}
> and
> {code:drl}
> package org.hightea.b
> import org.drools.compiler.Message
> import org.drools.compiler.SecondClass
> rule "RG_2"
> when
> $event: Message()
> SecondClass(item1 == $event.message1)
> then
> System.out.println("RG_2");
> end
> {code}
> We create a module containing the two packages in two drl files and insert a `SecondClass` fact in the WM.
> Then we want to incrementally update to a new module containing only the second DRL.
> At first fireAllrules after update, we encounter a NPE in RuleNetwork evaluator (a Segment memory is not defined in the path memory)
> {code:java}
> java.lang.NullPointerException
> at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:114)
> at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:212)
> at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:87)
> at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:34)
> at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
> at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1067)
> at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1014)
> at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1006)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1320)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1311)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1295)
> at org.hightea.IncrementalRemoveRuleTest.testNpeInRuleNetworkEvaluator(IncrementalRemoveRuleTest.java:66)
> {code}
> Note that we don't encounter this issue when the packages names are the same, or if we exchange the order of drl file name in the first module.
> A reproducer is attached with its source code at [https://github.com/hightea/drools-reproducer/tree/path-memory-issue|https://github.com/hightea/drools-reproducer/tree/path-memory-issue]
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list