We're using drools and allow our users to enter their own drools rule conditions and consequences. However, to make the whole drools stuff more reliable, we need to make sure no infinite loops or other blocking things block the whole system.
For rule-loops (rule A -> rule B -> rule A -> ...) we have measures taken. However, it is still possible to use something like
for(int i=0; i<1000000; i++) {
doSomething();
}
The problem is that we cannot avoid all this using blacklists or something, so we need a drools measure to do this.
Using session.halt()
on the current KnowledgeSession doesn't abort the consequence part. session.dispose()
results in the consequence being run even though the session is dead already, which is not what we need.
I also didn't find some "maximum execution time", which could limit the time a consequence execution is allowed to take before it is terminated.
Also tried to add a hook to the beforeActivationFired, which starts a thread, which waits 10s and then uses agendaItem.cancel()
as well as removing the rule from the kBase. To no avail, the rule consequence kept on running.
Any ideas would be helpful.