fission-workflows icon indicating copy to clipboard operation
fission-workflows copied to clipboard

Infinite Recursion Detection

Open erwinvaneyk opened this issue 7 years ago • 2 comments

Given that a major emphasis is made on re-using workflows and recursion over iteration. It is vital for the workflow engine to have some sort of recursion detection.

Solution 1 A "parent" parameter could be added (as a header for example) that links a workflow to its parent workflow. From there the workflow engine can analyze the workflow dependency graph to determine whether a infinite recursion is occurring

Potential issues:

  • Requires centralized state (of the dependency graph) when multiple workflow engine instances are running.
  • Compute intensive

Solution 2 Add a stack parameter to the request, containing all preceding workflow invocation ids. The workflow engine can infer can simply call a stack overflow if the stack becomes to large.

Potential issues:

  • Depending on the stack limit, the request size may become a significant overhead to the request.

...

erwinvaneyk avatar Aug 09 '17 00:08 erwinvaneyk

What about Solution 2, but with a count instead of the actual list?

soamvasani avatar Aug 09 '17 00:08 soamvasani

@soamvasani seems like a good trade-off indeed. Although in that case you the engine cannot provide feedback on where the (infinite) recursion/error actually took place/started. Not sure if that is a realistic use case though.

erwinvaneyk avatar Aug 09 '17 00:08 erwinvaneyk