I can't interrupt an expression evaluation
Closed this issue · 1 comments
Is your feature request related to a problem? Please describe.
The feel engine is currently stuck while executing long-running expressions because of the lack of "cooperation mode" (ref). It is not possible to interrupt the execution from outside the engine.
Related forum discussion: https://forum.camunda.io/t/feelengines-cooperation-mode-while-performing-longrunning-and-resource-consuming-operations/51049
We are using org.camunda.feel.FeelEngine instance to evaluate FEEL expressions and trying to find a proper way to “sandbox” this operation and give a dedicated timeout for each one, in case the user tries to execute a malicious expression.
We’ve came across the following expression as an example of such harmful snippet which can bring the instance down:count(for x in 1..(2 ** 16) return {"power": 2 ** x}) > 0
Describe the solution you'd like
The most classical solution is to repeatedly check whether the current thread was interrupted and throw an appropriate exception