Rikkola commented on code in PR #6707:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6707#discussion_r3309875111


##########
drools-core/src/main/java/org/drools/core/phreak/RuleExecutor.java:
##########
@@ -311,7 +311,9 @@ public void removeDormantTuple(RuleTerminalNodeLeftTuple 
tuple) {
                 throw new IllegalStateException();
             }
         }
-        dormantMatches.remove(tuple);
+        if (tuple.getPrevious() != null || dormantMatches.getFirst() == tuple) 
{
+            dormantMatches.remove(tuple);
+        }

Review Comment:
   No ask away. I have already learned more while finding the explanations.
   
   What you are asking is a reproducer for this bug with DRL. So we would all 
like to know it and that would give the actual data :-(  
   
   Best bet is `removeActiveTupe` in `RuleExecutor`. Tuple is doing a direct 
DELETE and then adding to dormant tuples would be wrong. However in some other 
location we still try to clean it up.
   
   ```    
       public void removeActiveTuple(RuleTerminalNodeLeftTuple tuple) {
           tuple.setQueued(false);
           activeMatches.remove(tuple);
           if (tuple.getStagedType() != Tuple.DELETE) {
               addDormantTuple(tuple);
           }
           if (queue != null) {
               removeQueuedLeftTuple(tuple);
           }
       }
   ```
   
   The risk here is we are not fixing the real bug, but I trust the reporters 
have tests to make sure the results the rules give are correct. Another way 
would be, we give the user with the issues a setup that collects as much data 
as possible when this issue occurs. 



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