Skip to content

Multiple executions of activities after WaitAny Join when using multiple loops before it #6921

@ispasoiurobert

Description

@ispasoiurobert

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.

  1. 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.

  2. Code Snippets: src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/FlowJoin.cs:52case 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 ).

  3. Attachments:

  4. 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

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions