[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2810) NullPointerException in Drools 5.1.1 - retractLeftTuple()
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Thu Dec 23 11:03:18 EST 2010
[ https://issues.jboss.org/browse/JBRULES-2810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572209#comment-12572209 ]
Mark Proctor commented on JBRULES-2810:
---------------------------------------
>From Tom Murphy in email:
1. It is a stateful session.
2. There are no dynamic rule adds - rules are compiled up front from a DB, in DRL format, then held in memory. Stateful Sessions are initiated against the static rule base.
3. Different test cases will cause different rules to throw, and the various rules that cause it are updating different objects in their right hand side. The consequence side of this particular rule is updating a PolicyBorrower object, with one field value change, plus adding a firing trace to its collection of firings.
The PolicyBorrower is a relatively simple object, and is updated in similar ways in many rules. Of the other rules that reference PolicyBorrower on the LHS, a few of them do have nested CE's with not { x{} and y{}} or exists { a{} and b{} } etc. However, in attempting to progressively remove those rule sets from the rule base, I'm finding that other rules, not related to these, are throwing other exceptions.
I don't want to confuse things with potentially different causes / problems, but here's one with different behavior -- it is throwing during an insert operation (trace is elided):
The rule is no different from other rules we're using, and this is the same rule base as with the earlier exception, but it's a different test case (This particular run is on Drools BRMS 5.1.0 and it also works perfectly on Community 5.0.1).
{code}
org.drools.RuntimeDroolsException: Exception executing predicate com.wellsfargo.GeneratedRules.Rule_RS8247_3_3_RF6366_54_50012769_0Predicate0Invoker at d2afb52f
...
Caused by:
Exception executing predicate com.wellsfargo.GeneratedRules.Rule_RS8247_3_3_RF6366_54_50012769_0Predicate0Invoker at d2afb52f
...
Caused by:
null
at com.wellsfargo.GeneratedRules.Rule_RS8247_3_3_RF6366_54_50012769_0.predicate0(Rule_RS8247_3_3_RF6366_54_50012769_0.java:9)
at com.wellsfargo.GeneratedRules.Rule_RS8247_3_3_RF6366_54_50012769_0Predicate0Invoker.evaluate(Rule_RS8247_3_3_RF6366_54_50012769_0Predicate0Invoker.java:23)
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:272)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:368)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
at com.wellsfargo.ARGenT.Execution.DefaultLoader.Load(DefaultLoader.java:16)
...
The DRL of this rule is:
rule "RS8247.3.3_RF6366_54_50012769"
dialect "java"
no-loop true
ruleflow-group "RF6366_54_50012769"
when
LoanFile
(
$parentLendingTransactionId : myId
)
$borrower : Borrower
(
parentId == $parentLendingTransactionId
, $parentBorrowerId : myId
, firings not contains "RS8247.3.3_RF6366_54_50012769"
)
IndividualName
(
parentId == $parentBorrowerId
, $parentBorrowerNameId : myId
, $fullName : fullName
)
Employment
(
parentId == $parentBorrowerId
, $parentEmploymentId : myId
, selfEmployedIndicator == true
, eval(((employmentDuration.getYear() * 12) + employmentDuration.getMonth()) >= 12)
, eval(((employmentDuration.getYear() * 12) + employmentDuration.getMonth()) < 24)
)
PersistenceDetail
(
parentId == $parentBorrowerId
, $parentPersistenceDetail1Id : myId
, $sequenceNbr1 : sequenceNbr
)
TransactionDetail
(
parentId == $parentLendingTransactionId
, $parentTransactionDetailId : myId
)
$policySet : PolicySet
(
parentId == $parentTransactionDetailId
, $parentPolicySetId : myId
)
PolicySetIdentifier
(
parentId == $parentPolicySetId
, $parentPolicySetIdentifierId : myId
, exitStrategyType in (ExitStrategyTypeEnum.FHA, ExitStrategyTypeEnum.VA)
)
then
WorkingObjectStipulation stipulation = $policySet.addNewStipulation();
PersistenceDetail persistenceDetail1 = stipulation.addNewPersistenceDetail();
stipulation.setMessageId("30002");
persistenceDetail1.setSequenceNbr($sequenceNbr1);
ParameterValue pv1 = stipulation.addNewParameterValue();
pv1.setActualValue(($fullName != null ? $fullName.toString() : "Missing"));
pv1.setParameterId("fullName");
insert(stipulation);
insert(persistenceDetail1);
insert(pv1);
$borrower.getFirings().add("RS8247.3.3_RF6366_54_50012769");
update($borrower);
update($policySet);
end
{code}
> NullPointerException in Drools 5.1.1 - retractLeftTuple()
> ---------------------------------------------------------
>
> Key: JBRULES-2810
> URL: https://issues.jboss.org/browse/JBRULES-2810
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-core
> Affects Versions: 5.1.1.FINAL
> Environment: WIndows Server 2K3 (32-bit) - JBoss 5 AS, Drools 5.1.1 Final,
> Reporter: Tom Murphy
> Assignee: Mark Proctor
>
> We recently switched to Drools 5.1.1 in our testing environments, and we are seeing a NullPointerException on a number of rule base / test case combinations. These all worked fine in 5.0.1.
> The rule in question is relatively simple, but the rule base is complex.
> It's difficult to send a test case, because the exception appears to occur only in large rule bases and layered rule flows.
> We have had to roll back to Drools 5.0.1 and are unable to adopt 5.1.1 until this is resolved.
> The relevant stack trace info is below.
> com.wellsfargo.ARGenT.Execution.ARGenTRunTimeException - org.drools.runtime.rule.ConsequenceException: rule: RS7673.1.3_RF6365_83_50011728
> ...
> Caused by:
> rule: RS7673.1.3_RF6365_83_50011728
> at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927)
> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
> at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)
> at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
> ...
> Caused by:
> null
> at org.drools.reteoo.RightInputAdapterNode.retractLeftTuple(RightInputAdapterNode.java:154)
> at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:217)
> at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateRetractRightTuple(SingleLeftTupleSinkAdapter.java:124)
> at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:151)
> at org.drools.reteoo.ModifyPreviousTuples.retractTuples(ModifyPreviousTuples.java:132)
> at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:176)
> at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442)
> at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349)
> at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183)
> at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196)
> at com.wellsfargo.GeneratedRules.Rule_RS7673_1_3_RF6365_83_50011728_0.defaultConsequence(Rule_RS7673_1_3_RF6365_83_50011728_0.java:9)
> at com.wellsfargo.GeneratedRules.Rule_RS7673_1_3_RF6365_83_50011728_0DefaultConsequenceInvoker.evaluate(Rule_RS7673_1_3_RF6365_83_50011728_0DefaultConsequenceInvoker.java:29)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856)
> at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071)
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785)
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751)
> at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
> ...
> The line identified in in the exception from retractLeftTuple is in the for loop, and it references factHandle without first checking for null:
> // retrieve handle from memory
> final InternalFactHandle factHandle = (InternalFactHandle) memory.remove( tuple );
> >>>>>> for ( RightTuple rightTuple = factHandle.getFirstRightTuple(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getHandleNext() ) {
> rightTuple.getRightTupleSink().retractRightTuple( rightTuple,
> context,
> workingMemory );
> }
> factHandle.setFirstRightTuple( null );
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list