Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3234

NPE on modify when using lock-on-active after assert

    XMLWordPrintable

Details

    Description

      I receive an NPE when attempting to modify a fact in a rule consequence if multiple prior rules have modified the same fact.

      It appears to involve the interaction between 3 rules, each of which is in a different agenda group. For background, this is a fraud detection application. Under certain conditions, we need to look up additional customer information. Some rules are run to determine whether the lookup is required and then another rule actually does the lookup. In this case:

      Rule 021 says if the order is small, set the lookup flag on the customer fact to false
      Rule 042B says if the order is from a 'bad' country, set the lookup flag on the customer fact to true
      Rule 022 says if the lookup flag is true, do the lookup, set the results on the customer flag and set the lookup flag on the customer fact

      If rule 021 fires alone, then 022 does not fire and all is well.
      If rule 042B fires alone, then 022 fires and all is well.
      If 021 fires to turn off the lookup AND 042B fires to turn on the lookup, then 022 gets and NPE.

      As Edson suspected, the item is null and the 'rule' variable points to rule 021.

      Each rule involved is in a different agenda group.

      This works in 5.2.0.Final, but breaks in 5.3.0.CR1.

      Attachments

        1. Drools runtimes.png
          Drools runtimes.png
          64 kB
        2. JBRULES-3234.zip
          5 kB
        3. nullpointer.txt
          14 kB
        4. rulest.txt
          3 kB
        5. Test output.txt
          3 kB

        Activity

          People

            mproctor@redhat.com Mark Proctor
            jeshaw70 Jamie Shaw (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: