Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1295521

Summary: Drools execution stuck due to infinite loop
Product: [Retired] JBoss BRMS Platform 6 Reporter: Alessandro Lazarotti <alazarot>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: alazarot, lpetrovi, mfusco, mweiler, mwinkler
Target Milestone: DR1   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1288009 Environment:
Last Closed: 2020-03-27 19:10:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1288009    
Bug Blocks:    

Description Alessandro Lazarotti 2016-01-04 18:35:32 UTC
+++ This bug was initially created as a clone of Bug #1288009 +++

Description of problem:
Executing a process with multiple BusinessRulesTask is getting stuck in an infinite loop.

A sucessfully validated DRL  is executed by a jbpm process . The execution stops at the node where the business rule task should be executed; the java process consumes all available CPU time and the BPM Suite execution is not possible for any other process.

If the complete DRL is used, the behaviour desribed above occurs. If one of the rules is ommitted, the rule execution works! Here is a simplified version of those rules:

rule r1 ruleflow-group "group1"
    salience 100
when                      
    $person: Person( $addressList : addresses ) 
    Address( zipCode == "10243" ) from $addressList
    $cheese : Cheese( )
then
    System.out.println("r1 executed");
end

rule r2 ruleflow-group "group1"
    salience 5
when                      
    $person: Person( $addressList : addresses ) 
    Address( zipCode == "10318" ) from $addressList
    $cheese : Cheese( )  
then
    System.out.println("r2 executed");
end

Note the usage of the 'from' keyword. Its usage with very similar fact attributes seems to confuse the whole evaluation algorithm.

We have simulated the problem in a unit test and have found that the evaluation of rules repeatedly (infinited)  executes the method org.drools.core.reteoo.FromNode.createPeer() 

https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java#L208

Taking a heap dump after the infinite loop is entered showed a huge number of FromNodeLeftTuple instances.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. See reproducer

Actual results:
Drools enters an infinite loop

Expected results:
Process and rules execution finishes normally


Additional info:
This is fixed by the changes related to DROOLS-992:
https://issues.jboss.org/browse/DROOLS-992
https://github.com/droolsjbpm/drools/commit/13bb9a748d5af562e334e499937e772a1c2774a5

--- Additional comment from Martin Weiler on 2015-12-03 05:16 EST ---

Attaching the reproducer provided by the customer as private attachment, as it contains customer specific data. For internal usage only!

--- Additional comment from JBoss Product and Program Management on 2015-12-03 05:20:08 EST ---

Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Mario Fusco on 2015-12-04 08:43:16 EST ---

Fix backported to 6.3.x branch with https://github.com/droolsjbpm/drools/commit/245acce2f

Comment 2 Marek Winkler 2016-03-18 14:40:18 UTC
Verified in BRMS 6.3.0.ER1.