Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2810

NullPointerException in Drools 5.1.1 - retractLeftTuple()

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 5.1.1.FINAL
    • Fix Version/s: 5.2.0.M1
    • Component/s: drools-core
    • Labels:
      None
    • Environment:

      WIndows Server 2K3 (32-bit) - JBoss 5 AS, Drools 5.1.1 Final,

    • Steps to Reproduce:
      Hide

      See description - am only able to reproduce in our large rule base. Subsets of the rule base do not appear to produce the behavior.

      Show
      See description - am only able to reproduce in our large rule base. Subsets of the rule base do not appear to produce the behavior.

      Description

      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 );

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tirelli tirelli
                  Reporter:
                  temurphy Tom Murphy
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: