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

Stateful session stops working after upgrade with same rule

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.40.0.Final
    • 7.73.0.Final, 8.38.0.Final
    • core engine
    • None
    • 2023 Week 18-20 (from May 1), 2023 Week 21-23 (from May 22)
    • NEW
    • NEW
    • ---
    • ---

    Description

      We have an issue where stateful session completely stops working after upgrading a rule with minor changes which should not affect behaviour at all.

      In this case, just removing an unused import from .drl makes the rule stop triggering, even though precondition facts are present.

      I read that if there is a runtime exception in LHS, rule engine can become corrupted. It behaves like that, even though there are no exceptions at all, so we cannot catch anything and revert. This makes modifying rules during system operation very unpredictive - same rule should behave the same during initial load and after every upgrade that didn't change it.

      Reproducer test case is attached.

      Problematic drl: testRuleUpgradeInvalid.drl

      Test case only removes the 9th line (unused import statement) and after the knowledge base upgrade to a new version, expected InstrumentState=NOMINAL fact is missing.

      This can be mitigated by modifying the "invalid" drl in one of the following ways:

      1. replacing the root OR for MAINTENANCE rule with two rules instead: testRuleUpgradeValidNoOr.drl
        • I read that Drools internally convert root or clauses into multiple rules, however this gives me no logical answer why this happens
      2. inserting exists clause before composite OR condition in MAINTENANCE rule: testRuleUpgradeValidExists.drl
        • this whole condition tree in maintenance rule is not satisfied by currently inserted facts so it should not affect the NOMINAL rule firing, whether it is written with or without exists keyword
      3. adding a "members" variable declaration in STOPPED rule: testRuleUpgradeValidVarDeclaration.drl
        • members variable is not used at all in whole drl so it should not affect operation, but it does

      Expected operation should be consistent regardless if rule engine is upgraded or just initialized once with the same rules, or throw an error if there is one in DRL.

      Attachments

        Issue Links

          Activity

            People

              mfusco@redhat.com Mario Fusco
              alan.sambol Alan Sambol (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: