Orchestration instance stuck in a partial RunAsync execution cycle after a request to Abort
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 335
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 6
Description
The RunAsync of an orchestration calls a suborchestration, waits for the result, then acts upon it, and finally calls ContinueAsNew. In the implementation of the system, there are situation where we want to Abort the orchestration instance.
However, it seems that if that request to abort via TerminateInstanceAsync is made around (possibly immediately after) the sub orchestration completion, the orchestration continues the RunAsync exection all the way to the end where it calls ContinueAsNew...At that point in time, the runtime reports this exception:
System.InvalidOperationException: Multiple ExecutionCompletedEvent found, potential corruption in state storage
at DurableTask.Core.OrchestrationRuntimeState.SetMarkerEvents(HistoryEvent historyEvent) in /_/src/DurableTask.Core/OrchestrationRuntimeState.cs:line 256
at DurableTask.Core.TaskOrchestrationDispatcher.ProcessWorkflowCompletedTaskDecision(OrchestrationCompleteOrchestratorAction completeOrchestratorAction, OrchestrationRuntimeState runtimeState, Boolean includeDetails, Boolean& continuedAsNew) in /_/src/DurableTask.Core/TaskOrchestrationDispatcher.cs:line 816
at DurableTask.Core.TaskOrchestrationDispatcher.OnProcessWorkItemAsync(TaskOrchestrationWorkItem workItem) in /_/src/DurableTask.Core/TaskOrchestrationDispatcher.cs:line 399
at DurableTask.Core.TaskOrchestrationDispatcher.OnProcessWorkItemSessionAsync(TaskOrchestrationWorkItem workItem) in /_/src/DurableTask.Core/TaskOrchestrationDispatcher.cs:line 194
at DurableTask.Core.WorkItemDispatcher`1.ProcessWorkItemAsync(WorkItemDispatcherContext context, Object workItemObj) in /_/src/DurableTask.Core/WorkItemDispatcher.cs:line 459
followed by trace events about abandoning a couple of control messages as follows:
8c06fe74-7f26-44af-8c8e-74b747e2ea2c: Message [ExecutionTerminated] with ID e03ebdff-c5b9-4e7f-a43f-405cb180a7c2 has been dequeued 26 times and is now considered poison
8c06fe74-7f26-44af-8c8e-74b747e2ea2c: Message [SubOrchestrationInstanceCompleted#1] with ID 9e975302-87f8-4f46-8cb6-bce368f99778 has been dequeued 26 times and is now considered poison
Eventually, every 10 minutes (the max of visibility timeout set on messages) this repeats in a loop - our custom trace messages following the sub-orchestration completion are logged, followed by above exception, and the abandonment of the 2 control messages.
It appears that the ExecutionTerminated event and the completion of the RunAsync with ContinueAsNew end up in conflict causing the return of that message batch back to the control queue for retry?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.