elsa-workflows / elsa-workflows/elsa-core
Wofkflow fails when using Delay activity in Elsa 3.7.0
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## Description
Am having an issue with using Delay activity in Elsa 3.7.0. It worked fine in Elsa 3.3.5.
There is a Main workflow that triggers an inner "Get user approval" workflow. The inner workflow waits for user input provided by calling an http endpoint. There is also a Delay activity that periodically send email reminder to the entitlede user. For the sake of simplicity I removed the emailing itself and let their only the Delay activity.
In real-world scenario the worfklow is much more complex, but I created a simple workflow to demonstrate the issue easily.
[Main workflow.json](https://github.com/user-attachments/files/28837073/Main.workflow.json)
[User approval workflow.json](https://github.com/user-attachments/files/28837074/User.approval.workflow.json)
## Actual Behaviour
When starting the workflow, it properly reaches the first "get user approval" workflow and waits for user input (http endpoint). Once the http request is sent the workflow proceeds but end in Faulted status with the error below.
## Expected Behaviour
When starting the workflow, it properly reaches the first "get user approval" workflow and waits for user input (http endpoint). Once the http request is sent the workflow proceeds and continues to the subsequent activity in the flow
## Replication Rate
100% on Elsa 3.7.0
0% on Elsa 3.3.5
## Steps to Reproduce
1. Import attached worfklows - User approval worfklow.json and Main workflow.json
2. Start thwe Main workflow in Elsa studio - the workflow should be started and will wait for user input on http endpoint
3. Send http request, use this CURL:
a) replace the hostname:port to match the one on your machine
b) replace with the instance ID of the started workflow
curl --location 'https://localhost:7701/api/workflows/workflow1' \
--header 'Content-Type: application/json' \
--header 'X-Workflow-Instance-Id: WORKFLOWINSTANCEID' \
--data ''
4. After sending the request the workflow goes to Faulted state with an error like that:
```
ActivityId
bc57b120f2cd7ed2
ActivityNodeId
Workflow2:dfdb6af2d7223797:f5a9812cddd3e2b2:Workflow1:bfd0569b156f6fc4:bc57b120f2cd7ed2
Message
Activity 2a5c120d75b35da7 is not reachable from the flowchart graph. Unable to schedule it's outbound activities.
StackTrace
at Elsa.Workflows.Activities.Flowchart.Activities.Flowchart.MaybeScheduleOutboundActivitiesAsync(FlowGraph flowGraph, FlowScope flowScope, ActivityExecutionContext flowchartContext, IActivity activity, ActivityExecutionContext completedActivityContext, Outcomes outcomes, ActivityCompletionCallback completionCallback, Boolean completedActivityExecutedByBackwardConnection)
at Elsa.Workflows.Activities.Flowchart.Activities.Flowchart.OnCounterFlowActivityCanceledAsync(CancelSignal signal, SignalContext context)
at Elsa.Workflows.Activity.Elsa.Workflows.ISignalHandler.ReceiveSignalAsync(Object signal, SignalContext context)
at Elsa.Extensions.ActivityExecutionContextExtensions.SendSignalAsync(ActivityExecutionContext activityExecutionContext, Object signal)
at Elsa.Workflows.ActivityExecutionContext.CancelActivityAsync()
at Elsa.Workflows.ActivityExecutionContext.CompleteActivityAsync(Object result)
at Elsa.Workflows.Activities.Flowchart.Activities.Flowchart.ProcessChildCompletedAsync(ActivityExecutionContext flowchartContext, IActivity completedActivity, ActivityExecutionContext completedActivityContext, Outcomes outcomes)
at Elsa.Workflows.Activities.Flowchart.Activities.Flowchart.OnChildCompletedCounterBasedLogicAsync(ActivityCompletedContext context)
at Elsa.Workflows.Behaviors.ScheduledChildCallbackBehavior.OnActivityCompletedAsync(ActivityCompleted signal, SignalContext context)
at Elsa.Workflows.Behavior.Elsa.Workflows.ISignalHandler.ReceiveSignalAsync(Object signal, SignalContext context)
at Elsa.Workflows.Activity.Elsa.Workflows.ISignalHandler.ReceiveSignalAsync(Object signal, SignalContext context)
at Elsa.Extensions.ActivityExecutionContextExtensions.SendSignalAsync(ActivityExecutionContext activityExecutionContext, Object signal)
at Elsa.Workflows.ActivityExecutionContext.CompleteActivityAsync(Object result)
at Elsa.Workflows.Behaviors.AutoCompleteBehavior.ExecuteAsync(ActivityExecutionContext context)
at Elsa.Workflows.Behavior.Elsa.Workflows.IBehavior.ExecuteAsync(ActivityExecutionContext context)
at Elsa.Workflows.Activity.Elsa.Workflows.IActivity.ExecuteAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.DefaultActivityInvokerMiddleware.ExecuteActivityAsync(ActivityExecutionContext context)
at Elsa.Workflows.Runtime.Middleware.Activities.BackgroundActivityInvokerMiddleware.ExecuteActivityAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.DefaultActivityInvokerMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Runtime.Middleware.EvaluateLogPersistenceModesMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.NotificationPublishingMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.ExecutionLogMiddleware.InvokeAsync(ActivityExecutionContext context)
at Elsa.Workflows.Middleware.Activities.ExceptionHandlingMiddleware.InvokeAsync(ActivityExecutionContext context)
```
Any ideas or a fix are appreciated! Thanks.
Jiri Matejka
Contributor guide
Assessment
This issue has not been assessed yet.