It is possible within the rules engine to create a scenario where a set of rules cause an infinite loop. Take for example the following rule that has a When Condition to itself:
This example is very simple but when you have some very complex rules then this loop isn't obvious to the Content Editor or Developer (e.g. the loop could be caused by 4 or 5 chained rules).
This loop causes a Stack Overflow exception which brings the entire server down.
Has anyone written anything to detect these loops or found another way to solve this?
Unfortunately looking at the RuleFactory class it is static so can't be replaced. I was hoping to maybe use something like the RuleStack class but the RuleStack is not global to all rules, a new one is created when the WhenCondition is called.
Any ideas? We are using Sitecore 8.1 U3.