]
RH Bugzilla Integration commented on DROOLS-629:
------------------------------------------------
Marek Winkler <mwinkler(a)redhat.com> changed the Status of [bug
NullPointerException thrown on next call to insert and fireAllRules
after stream garbage collection runs
--------------------------------------------------------------------------------------------------------
Key: DROOLS-629
URL:
https://issues.jboss.org/browse/DROOLS-629
Project: Drools
Issue Type: Bug
Affects Versions: 6.1.0.Final, 6.2.0.Beta3
Reporter: Mike Wilson
Assignee: Mario Fusco
Fix For: 6.2.0.CR1
Attachments: drools-gc-causes-npe-example.zip
I have observed that the following NullPointerException (NPE) occurs consistently with a
very specific set of rules and a very specific set of inputs into a stream session:
{code}
java.lang.NullPointerException
at
org.drools.core.util.AbstractHashTable$SingleIndex.equal(AbstractHashTable.java:491)
at org.drools.core.util.index.LeftTupleList.matches(LeftTupleList.java:266)
at
org.drools.core.util.index.LeftTupleIndexHashTable.get(LeftTupleIndexHashTable.java:434)
at
org.drools.core.util.index.LeftTupleIndexHashTable.getFirst(LeftTupleIndexHashTable.java:217)
at org.drools.core.reteoo.BetaNode.getFirstLeftTuple(BetaNode.java:443)
at org.drools.core.phreak.PhreakJoinNode.doRightInserts(PhreakJoinNode.java:144)
at org.drools.core.phreak.PhreakJoinNode.doNode(PhreakJoinNode.java:56)
at
org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:548)
at
org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:534)
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:229)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:98)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:988)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1274)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1281)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1254)
...
{code}
The exception always occurs on the next call to "insert" and
"fireAllRules" after the following method is invoked within the session:
org.drools.core.common.DefaultAgenda$DefaultGarbageCollector.forceGcUnlinkedRules().
I have attached a maven project that contains a JUnit test, which reproduces this
exception using Drools version 6.2.0.Beta3.
A side effect of this exeption occurring in the middle of fireAllRules is that an extra
fact is left over in working memory, which is essentially a memory leak. I assume this is
because the evaluation of the LHS of the rules is what causes the NPE to occur, so the
fact is not deleted, because the RHS of the rules don't execute.