Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Finished executing Fork with asynchronous activities unexpectedly #5956

Open
iio888 opened this issue Sep 11, 2024 · 0 comments
Open

[BUG]Finished executing Fork with asynchronous activities unexpectedly #5956

iio888 opened this issue Sep 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@iio888
Copy link

iio888 commented Sep 11, 2024

Description

To execute activities of Fork in parallel, I marked activities as Task and set RunAsynchronous to be true. But the workflow contains the fork finished with Suspended status unexpectedly and didn’t execute any activity in Fork.

Steps to Reproduce

  1. Sample Code:
Sequence seq = new()
{
  Activities = {
    new Fork()
    {
      Branches = 
      {
        new Do(c => 
        {
          Thread.Sleep(1000);
          Console.WriteLine(13);
        }) { RunAsynchronously = true },

        new Do(c => 
        {
          Console.WriteLine(11);
          Thread.Sleep(2000);
          Console.WriteLine(15);
        }) { RunAsynchronously = true },
                
        new Do(c => 
        {
          Thread.Sleep(100);
          Console.WriteLine(12);
        }) { RunAsynchronously = true },
      }
    },
    new Do(c => Console.WriteLine(2),
  }
};

var services = new ServiceCollection();
var provider = services.BuildServiceProvider();
var runner = provider.GetRequiredService<IWorkflowRunner>();

var r = await runner.RunAsync(seq);

[Activity(“Elsa”, Kind = ActivityKind.Task)]
public class Do : Inline
{
  public Do(Action<ActivityExecutionContext> action)
    : base(action) 
  {  }
}

Expected Behavior

The workflow was supposed to execute activities of ‘Fork` in parallel.

Actual Behavior

None of activities in Fork are executed. The workflow contains the Sequence ran into Suspended status and met 3 bookmarks which are related to 3 activities in Fork.

Environment

  • Elsa Package Version: 3.1.3
  • Operating System: Windows 10

Log Output

Include any relevant log output or error messages that might help diagnose the issue.

Related Issues

Also, Can Fork finish after its activities executed in parallel which looks like Task.WaitAll() or Task.WaitAny()?

@iio888 iio888 added the bug Something isn't working label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant