[rules-users] Frequently updated facts and truth maintenance

Wolfgang Laun wolfgang.laun at gmail.com
Fri May 7 03:21:31 EDT 2010


Will isDeltaFlag(flag) ever return false after an update to a Sensor object?
(If not I'd say that this is at the root of the problem, but I doubt that
logical is the preferred choice here.)

Which truth do you want to be maintained by the DeltaFlagged facts?

What is the ultimate purpose of DeltaFlagged facts being around galore
in this constantly changing scenario?

-W

2010/5/6 bill simms <sitrious at gmail.com>:
> Hello,
>
> Recently I've been using Drools (version 5.0.1) to build a small sensor
> monitoring application and have run into memory consumption issues that seem
> to be related to logically inserted facts.  The way it is set up there are
> Sensor facts which carry numerically encoded "flags" that can signal certain
> properties about that Sensor.  My intent was to create rules to detect these
> flags and insert marker facts in order to abstract how flagging is handled
> and make it easier for other rules to use this information.  Here is an
> example of the rules I'm using:
>
>
>> declare DeltaFlagged
>>     sensor : Sensor @key
>> end
>
>
>>
>> rule "Delta Flagged"
>> agenda-group "delta flag inference"
>> auto-focus true
>>     when
>>         $sensor:    Sensor(eval(isDeltaFlag(flag)))
>>     then
>>         DeltaFlagged flagged = new DeltaFlagged();
>>         flagged.setSensor($sensor);
>>         insertLogical(flagged);
>> end
>
> Each Sensor is updated at regular intervals from outside of the rule engine,
> several hundred times a day.  Similar to the examples given here (
> http://blog.athico.com/2007/03/writing-rules-for-monitoring-and-time.html
> ).  This works very well for short periods of time.  However, after many
> days of operation I can observe a clear memory leak trend.  When I inspect a
> memory dump I see that there are many LogicalDependency objects created and
> stored by the truth maintenance system (on the order of several million) for
> each "flag" fact that has been logically inserted. Only one fact is being
> inserted per Sensor as expected.  I am working under the impression that
> Drool's truth maintenance should not be recording duplicate dependencies, so
> I'm wondering what I have done wrong with the equals() and hashcode()
> methods of my objects to cause Drools to treat each activation of this rule
> as a new dependency.  My Sensor objects use the default hashcode and equals
> methods.  Thank you in advance.
>
> Bill
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>




More information about the rules-users mailing list