dcmaf commented on issue #6422:
URL: 
https://github.com/apache/incubator-kie-drools/issues/6422#issuecomment-3192958947

   Moving the workaround to removeDormantTuple also fixes the case we saw with 
logical facts:
   
   ```java
       public void removeDormantTuple(RuleTerminalNodeLeftTuple tuple) {
           if (DEBUG_DORMANT_TUPLE) {
               if (!tuple.isDormant()) {
                   throw new IllegalStateException();
               }
           }
   
           if (dormantMatches.contains(tuple))
               dormantMatches.remove(tuple);
           else
               log.warn("removeDormantTuple: Tuple not found on dormant list: 
{}", tuple);
   
           if (DEBUG_DORMANT_TUPLE) {
               tuple.setDormant(false);
           }
      }
   ```
   
   Here is a sample stack trace for the logical fact case:
   
   ```
   Caused by: java.lang.NullPointerException: Cannot invoke 
"org.drools.core.util.DoubleLinkedEntry.setNext(org.drools.core.util.SingleLinkedEntry)"
 because the return value of 
"org.drools.core.util.DoubleLinkedEntry.getPrevious()" is null
        at org.drools.core.util.LinkedList.remove(LinkedList.java:178) 
~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.RuleExecutor.removeDormantTuple(RuleExecutor.java:318) 
~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.PhreakRuleTerminalNode.doLeftDelete(PhreakRuleTerminalNode.java:270)
 ~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.PhreakRuleTerminalNode.doLeftDeletes(PhreakRuleTerminalNode.java:254)
 ~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.PhreakRuleTerminalNode.doNode(PhreakRuleTerminalNode.java:52)
 ~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:335)
 ~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:189)
 ~[drools-core-10.1.0-20250815.jar:10.1.0]
        at 
org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:147)
 ~[drools-core-10.1.0-20250815.jar:10.1.0]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to