Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1387

Rules using binding variables for properties in constraints are evaluated in class reactive.

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.4.0.GA, 7.7.1.GA
    • Fix Version/s: None
    • Component/s: BRE
    • Labels:
      None
    • Environment:

      The issue reproduces on 7.4.0 and later, and does not reproduce on 7.3.1 and before.

    • Target Release:
    • Steps to Reproduce:
      Hide
      1. Extract reproducer_02679559.zip attached in Attachments.
        $ unzip reproducer_02679559.zip
        
      2. Build the reproducer and execute it.
        $ cd reproducer_02679559
        $ mvn clean install exec:java
        
      3. See the output of the reproducer.
        Expected Result:
        Rule-1 is evaluated only once.
        ***** Action of rule-1
        

        Actual Result:
        Rule-1 is evaluated repeatedly though the number of rules fired is limited by KieSession#fireAllRules(10) in this reproducer.

        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        
      Show
      Extract reproducer_02679559.zip attached in Attachments. $ unzip reproducer_02679559.zip Build the reproducer and execute it. $ cd reproducer_02679559 $ mvn clean install exec:java See the output of the reproducer. Expected Result: Rule-1 is evaluated only once. ***** Action of rule-1 Actual Result: Rule-1 is evaluated repeatedly though the number of rules fired is limited by KieSession#fireAllRules(10) in this reproducer. ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1
    • Sprint:
      2020 Week 25-27 (from Jun 15), 2020 Week 31-33 (from Jul 27)

      Description

      When we use binding variables for properties of the data object in constraints, it looks like the rule is evaluated not in property reactive but in class reactive. Therefore, for pattern A in the following example rule, rule-1 is unexpectedly evaluated repeatedly. For pattern B or pattern C, the rule is evaluated only once (in property reactive) as expected.

      rule "rule-1"
        when
          /* pattern A -> NG */ $fact: Fact( $property: a, $property == 50 )
          /* pattern B -> OK */ // $fact: Fact( a == 50, $property: a )
          /* pattern C -> OK */ // $fact: Fact( a == 50 )
        then
          System.out.println("***** Action of rule-1");
          modify($fact) {
            setResult("OK")
          }
      end
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mfusco Mario Fusco
                Reporter:
                myoshida Masato Yoshida
                Tester:
                Daniel Rosa
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: