-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
Even if the join is on WaitAny mode, for any canceled loop activity that enters in it, the join gets executed once more ( with all the activities after it ).
See below.
-
Detailed Steps: Add a fork with multiple branches. Add one loop activity on every branch. ( it does not matter the type of loop, it reproduces for all ). Add anything in those loops ( in my case: delay and WriteLines ). Have one of those loops finish first. Connect those to a WaitAny Join. Add any activity after the join.
-
Code Snippets: src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/FlowJoin.cs:52
case FlowJoinMode.WaitAny: { Flowchart.CancelAncestorActivatesAsync(context); await context.CompleteActivityAsync(); break; }
For the first loop that completes, the join is also completed ( completedAt field is set and also the status is set ).
When the second loop is canceled, that part of code is executed once more, but this time the join execution context does not have the last status set ( it will get completed once again ).
For the third loop that is canceled, there is a new join activity context created so that part of code is once again executed and the join is completed once more.
( in the screenshot, there are 2 executions shown for the join activity, bcs there were 2 activity context created, but activities after it will be executed 3 times ). -
Attachments:
- Workflow JSON: https://pastebin.com/rDruscJW ( test workflow json ) ( check the pastebin link ).
-
Reproduction Rate: everytime.
Expected Behavior
One loop to be completed and the other 2 to be canceled.
Only one execution of Join.
Only one execution for the activities after Join.
Actual Behavior
First loop is completed ✔️
The other 2 loops are canceled ✔️, but they are marked as completed ( see screenshot ). ❌
Multiple executions of Join. ❌
Multiple executions for the activities after Join. ❌
Screenshots

Environment
- Elsa Package Version: branch: patch/3.5.1, but also on version 3.4.2.
- Operating System: Windows 11.
- Browser and Version: Chrome 140.