Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-7420

NPE on TupleSetsImpl.setNextTuple with SubnetworkTuple

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.39.0.Final
    • None
    • core engine
    • None
    • 2023 Week 15-17 (from Apr 10)
    • NEW
    • NEW
    • ---
    • ---

      Issue Description:

      This rule:

      rule Rule1
      when
        not String()
        List() from collect (Integer() from new Integer [] {1,2})
        Boolean() // always false
      then
      end
      
      rule Rule2
      when
        not String()
        List() from collect (Integer() from new Integer [] {1,2})
       then
        insert(new String());
      end
      

      fails with (just fireAllRules without inserting a fact)

      java.lang.NullPointerException
      	at org.drools.core.common.TupleSetsImpl.setNextTuple(TupleSetsImpl.java:349)
      	at org.drools.core.common.TupleSetsImpl.removeInsert(TupleSetsImpl.java:167)
      	at org.drools.core.phreak.RuleNetworkEvaluator.doRiaNode2(RuleNetworkEvaluator.java:705)
      	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:334)
      	at org.drools.core.phreak.RuleNetworkEvaluator.doRiaNode(RuleNetworkEvaluator.java:631)
      	at org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:554)
      	at org.drools.core.phreak.RuleNetworkEvaluator.evalNode(RuleNetworkEvaluator.java:386)
      	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:346)
      	at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:182)
      	at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:140)
      	at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:235)
      	at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:179)
      	at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:110)
      	at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:33)
      	at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
      	at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:869)
      	at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:816)
      	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:808)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1333)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1324)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1308)
      	at org.drools.compiler.integrationtests.SubnetworkTest.subnetworkSharingWith2SinksBeforeRia(SubnetworkTest.java:494)
      

      because in the rightTuples in the RIA node, the order of 2 SubnetworkTuple (stagedNext/stagedPrevious) was inverted while rightTuples.inserFirst is not changed. The inversion was caused by previous PhreakFromNode.doLeftDeletes.

      This issue happens only with non-exec-model, because exec-model happens not to share the FromNodes. (This may be another issue, but no harm)

      Acceptance Criteria:

      • Don't throw NPE. Just Rule2 is executed

              mfusco@redhat.com Mario Fusco
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: