Infinite Loop

When designing your workflow it is possible to add workflow steps in such a way that it causes an infinite loop at runtime.

In most cases these infinite loops occur due to incorrect design, where steps loop back on to themselves without going through an asynchronous step (like a Task step, or a SmartObject step in which you've enabled the "Wait for an external system" option). In other cases, a step may trigger an external event that the workflow listens for to start new workflow instances and thus causes an infinite recursive loop of workflow instances. You can resolve infinite loop warnings by moving the steps around or by adding different paths for the workflow to follow.

In some cases, however, your workflow design might warn you about an infinite loop but the loop logic that you've configured is completely valid. In these cases, you can safely ignore the warning and deploy your workflow.

An infinite loop can cause the server to become unresponsive. Because of this, when an infinite loop is detected in your workflow design, you will see a yellow warning indicator on the step and a corresponding warning message in the error console. Additionally, you will see a general warning beneath the deployment button. Warning indicators never prevent you from deploying your workflow.

Here are some points to consider when you see this warning:

To help protect your K2 environment from runaway workflow instances, administrators can set Workflow Step Instances Threshold policies that will force workflows to go into an Error state if too many instances of a step occurred in a specified amount of time. See the Settings topic for more information about setting these policies.

Use the following examples for determining if you need to redesign your workflow or you can safely ignore the infinite loop warning.