How to terminate infinite loops
- Last Updated: April 30, 2021
- 2 minute read
- Corticon
- Version 7.2
- Documentation
By definition, infinite loops will not terminate by themselves. Therefore,
Corticon provides a safety valve that caps
the number of iterations allowed before the system automatically terminates a loop. The
default setting is 100, meaning that a loop is allowed to iterate up to 100 times normally.
After the number of loops exceeds the maxloops setting,
then the system automatically terminates the loop and generates a Violation error message. This means that the final number of loop iterations
will be 101: 100 normal iterations plus the final iteration that causes the Violation message to appear and the loop to terminate. The
following figure shows a Violation message:
If you are comfortable writing looping rules, and want the software to be able to loop more than 100 times, be sure to reset this property to a higher value. Keep in mind that the more iterations the system performs, the longer rule execution may take. If the Rulesheets you intend to deploy require high iteration counts, set the value that determines what constitutes an endless loop. For Decision Services that have Rulesheets with a Processing mode that allows looping , it is important to limit the loop count and prevent endless loops.
In the brms.properties file, add the
following property with your preferred maximum number of iterations allowed for any
loop:
com.corticon.reactor.rulebuilder.maxloops=100