elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

Workflow instance retry issue

Open reiven93 opened this issue 2 years ago • 5 comments

I have a workflow with some activities and some customs. One of the custom activity just does return Fault(); I'm using HangfireDispatcher. What I see is that if I press retry on the Elsa studio dashboard or using the retry API, the workflow status changes to Running but with a red label. Then, a warning appears in console of the Elsa server:

warn: Elsa.Services.Workflows.WorkflowInstanceExecutor[0]
      Did not run workflow f8575e9b296b4e75936eea2b1a6fba93 for activity 1b87793b-f7f6-4793-a377-de43550f2e47 because the workflow is not blocked on that activity nor is that activity scheduled for execution

If I check my workflow, the activity that is shown in the log is not the Faulted one, but the first of the workflow, so it fails. As I'm using HangfireDispatcher, a job is created and it shows the wrong activityId as an argument, matching the one that the elsa warning log shows. So, it seems that the dispatcher is not sending the correct activityId to revive. Looking into the code, seems that CurrentActivity is null here and, when this happens, it gets the first activity of the workflow:

imagen

When my workflowinstance is Faulted, I can see in database that there is a Faulted activity in the workflowinstances row of my workflow. Then, when retrying, the database shows what is expected to be scheduled right:

imagen

This is the ActivityId of the faulted Activity. But as I said, it dispatches the first of the workflow.

Because Elsa has a server down protection, if I just restart Elsa server, the workflow is auto dispatched with the faulted activity right and the execution continues.

reiven93 avatar Jun 30 '22 11:06 reiven93

A friend of mine has also tested it without/with Hangfire dispatcher and without/with custom activities (using the core Fault activity) and the result is the same, the dispatcher is not able to execute the faulted activity on retry, it starts the first of the workflow. Using Elsa 2.8.2

reiven93 avatar Jun 30 '22 19:06 reiven93

@smartwaystudio is working on this 💪🏻

sfmskywalker avatar Jul 11 '22 10:07 sfmskywalker

I am also facing the same problem. Created one custom activity which is returning Fault status and when I retry that instance from UI. Below is the screenshot of logging.

image

VartikaSharma14 avatar Jul 13 '22 08:07 VartikaSharma14

I'm encountering the need to restart ELSA after I send the retry api in order to continue with the activity that is faulted.

PeterHuang-ST avatar Jul 21 '22 15:07 PeterHuang-ST

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 20 '22 15:09 stale[bot]