-
Notifications
You must be signed in to change notification settings - Fork 114
Description
Currently when Clara enters an infinite loop it simply hangs and consumes large amounts of CPU and, depending on the loop scenario, memory. A simple example of this is a rule like the following:
(defrule cold-loop
[Cold (= ?t temperature)]
=>
(insert! (->Cold ?t)))
This scenario is obvious, but there are many less obvious scenarios that lead to loops. Clara could set a limit on the number of iterations of the fire-rules loop that could be performed before throwing an exception indicating that the rules are likely in an infinite loop. This number could be user-configurable; for example, the default could be a ridiculously large number of loop iterations that few if any users would actually need, with options to either change that number or eliminate the check. The exception thrown would be an ExceptionInfo instance containing listeners and other relevant debugging information.