You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that we're trying to populate the cache, and that includes adding the subworkflows of the current (sub)workflow, and, most importantly, we apparently assume that the subworkflows are not already in the cache.
I wonder if this isn't a problem all by itself. That is, if we have a complex workflow which uses multiple subworkflows which themselves use a set of common (sub-)subworkflows, then the leaf nodes of this tree would likely end up in the cache multiple times, and that might be annoying or downright problematic.
However, if we did a cache lookup before adding to the cache, that would prevent the problem in my example. And, if we were clever, we should be able to use the same technique to address the recursive reference causing the problem reported in this issue. That is, if we can complete adding the current subworkflow to the cache before moving on to its subworkflows, then a self-reference would "hit" the cache and the recursion would stop.
This would likely address the problem during load. However, presumably there would then be another problem during execution, where the workflow never finishes because it's waiting for a copy of itself to finish which is, in turn, waiting for a copy of itself. However, it's possible that this is a user error which the engine itself does not actually need to detect or solve, since it should become apparent to the user what has happened. Moreover, preventing this might adversely affect certain implementation approaches -- that is, "recursion" itself is not bad, only bottomless recursion is bad!
But, if we wanted to prevent the recursion problem at execution time, we could probably detect it at load time: if a subworkflow attempts to cache itself and gets a "hit" on the cache, that might be a good point at which to bail out, at least until some user expresses a desire to implement a recursive workflow on purpose. 🙂
Describe the bug
If a workflow references itself as a foreach subworkflow, it will infinitely load itself without a valid exit condition.
The text was updated successfully, but these errors were encountered: