How to protect Camunda from processes that enter into a dead loop?

Assuming an improper process definition with specific conditions leads to a process instance falling into a dead loop, how can we effectively terminate this process instance to prevent Camunda from consuming all available resources?

My initial thought is to implement an execution listener that monitor and enforce limits on the sequenceCounter of the current execution. However, I’m uncertain if this is an appropriate approach to mitigate this potential risk. Would this strategy be effective, or are there other, more robust methods I should consider ?

Greatly appreciate any advice, or recommendations you may have on this matter.

Hello my friend!
Welcome to the community!

It seems like a good solution to implement an execution listener containing logic for this validation.

But first, before anything else, we need to understand why your process would enter a loop, and avoid this as much as possible. Why would the retry be implemented explicitly? Is it really necessary? Is there no other way to avoid this?

If you really need it due to the need to execute other tasks in specific cases and this could cause your application to enter a loop, in this case it does make sense to implement the logic to validate in a global execution listener, or do it individually in the tasks that are needed.

Below is the link to the official Camunda documentation on execution listeners:

I hope this helps!

William Robert Alves

Thank you very much for your prompt response, which is of great help to me.

The reason why there might be a potential for my process to enter an infinite loop is that due to business requirements, we have encapsulated the creation of process definitions, aiming to provide a simplified modeler. This allows individuals who are not familiar with the Camunda process engine to customize processes for various business applications.

However, this approach also leads to the possibility of potential issues in the process definitions they orchestrate (we will consider implementing some means to conduct preliminary checks on these process definitions in the future, but we haven’t come up with a good solution yet).

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.