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

Fix handling of immediate child workflow cancellation #276

Closed
mfateev opened this issue Apr 5, 2020 · 0 comments · Fixed by #599
Closed

Fix handling of immediate child workflow cancellation #276

mfateev opened this issue Apr 5, 2020 · 0 comments · Fixed by #599
Assignees
Milestone

Comments

@mfateev
Copy link
Member

mfateev commented Apr 5, 2020

Currently when a single decision batch contains StartChildWorkflowExecution and RequestCancelExternalWorkflowExecution the cancellation fails and the child is started.
The expected behaviour is that the child is immediately cancelled ideally by writing the following events into the history:

  1. RequestCancelExternalWorkflowExecutionInitiated
  2. ExternalWorkflowExecutionCancelRequested
  3. ChildWorkflowExecutionCanceled

Here is an example history which shows the current broken behaviour:

   1  2020-04-05T16:34:53-07:00  EventTypeWorkflowExecutionStarted                         {WorkflowType:{Name:TestWorkflow_execute}, ParentInitiatedEventId:0,
                                                                                           TaskList:{Name:WorkflowTest-testChildWorkflowCancellation-49a80f10-fb1d-49c6-a9f1-282b2e31f460,
                                                                                           Kind:TaskListKindNormal}, Input:["WAIT_CANCELLATION_REQUESTED"],
                                                                                           ExecutionStartToCloseTimeoutSeconds:30, TaskStartToCloseTimeoutSeconds:5,
                                                                                           Initiator:ContinueAsNewInitiatorDecider, ContinuedFailureDetails:[], LastCompletionResult:[],
                                                                                           OriginalExecutionRunId:f2bc6299-a8b3-4996-9c0c-f4414f1a79bd, Identity:unknown-mac,
                                                                                           FirstExecutionRunId:f2bc6299-a8b3-4996-9c0c-f4414f1a79bd, Attempt:0, ExpirationTimestamp:0,
                                                                                           FirstDecisionTaskBackoffSeconds:0}
   2  2020-04-05T16:34:53-07:00  EventTypeDecisionTaskScheduled                            {TaskList:{Name:WorkflowTest-testChildWorkflowCancellation-49a80f10-fb1d-49c6-a9f1-282b2e31f460,
                                                                                           Kind:TaskListKindNormal}, StartToCloseTimeoutSeconds:5, Attempt:0}
   3  2020-04-05T16:34:53-07:00  EventTypeWorkflowExecutionCancelRequested                 {ExternalInitiatedEventId:0,
                                                                                           Identity:unknown-mac}
   4  2020-04-05T16:34:53-07:00  EventTypeDecisionTaskStarted                              {ScheduledEventId:2, Identity:unknown-mac,
                                                                                           RequestId:15e68a7d-672f-4e20-937c-3f3b3c646734}
   5  2020-04-05T16:34:53-07:00  EventTypeDecisionTaskCompleted                            {ExecutionContext:[],
                                                                                           ScheduledEventId:2,
                                                                                           StartedEventId:4,
                                                                                           Identity:unknown-mac}
   6  2020-04-05T16:34:53-07:00  EventTypeStartChildWorkflowExecutionInitiated             {WorkflowId:68563d49-3289-3c7a-9a39-e0e0d21d39bf,
                                                                                           WorkflowType:{Name:TestChildWorkflow_execute},
                                                                                           TaskList:{Name:WorkflowTest-testChildWorkflowCancellation-49a80f10-fb1d-49c6-a9f1-282b2e31f460,
                                                                                           Kind:TaskListKindNormal}, Input:[], ExecutionStartToCloseTimeoutSeconds:30,
                                                                                           TaskStartToCloseTimeoutSeconds:10, ParentClosePolicy:ParentClosePolicyAbandon,
                                                                                           Control:[], DecisionTaskCompletedEventId:5,
                                                                                           WorkflowIdReusePolicy:WorkflowIdReusePolicyAllowDuplicateFailedOnly}
   7  2020-04-05T16:34:53-07:00  EventTypeRequestCancelExternalWorkflowExecutionInitiated  {DecisionTaskCompletedEventId:5,
                                                                                           WorkflowExecution:{WorkflowId:68563d49-3289-3c7a-9a39-e0e0d21d39bf},
                                                                                           Control:[], ChildWorkflowOnly:true}
   8  2020-04-05T16:34:53-07:00  EventTypeRequestCancelExternalWorkflowExecutionFailed     {Cause:CancelExternalWorkflowExecutionFailedCauseUnknownExternalWorkflowExecution,
                                                                                           DecisionTaskCompletedEventId:-23, Namespace:UnitTest,
                                                                                           WorkflowExecution:{WorkflowId:68563d49-3289-3c7a-9a39-e0e0d21d39bf}, InitiatedEventId:7,
                                                                                           Control:[]}
   9  2020-04-05T16:34:53-07:00  EventTypeDecisionTaskScheduled                            {TaskList:{Name:unknown-mac:83e37a46-43b3-40e0-bbc0-a40f27208f84,
                                                                                           Kind:TaskListKindNormal}, StartToCloseTimeoutSeconds:5,
                                                                                           Attempt:0}
  10  2020-04-05T16:34:53-07:00  EventTypeChildWorkflowExecutionStarted                    {InitiatedEventId:6,
                                                                                           WorkflowExecution:{WorkflowId:68563d49-3289-3c7a-9a39-e0e0d21d39bf,
                                                                                           RunId:c4b71487-52e5-4984-a47d-105fa4478979},
                                                                                           WorkflowType:{Name:TestChildWorkflow_execute}}
  11  2020-04-05T16:34:53-07:00  EventTypeDecisionTaskStarted                              {ScheduledEventId:9,
                                                                                           Identity:83e37a46-43b3-40e0-bbc0-a40f27208f84,
                                                                                           RequestId:995457b0-b937-4333-b5c1-2b6083bee769}
  12  2020-04-05T16:34:53-07:00  EventTypeDecisionTaskCompleted                            {ExecutionContext:[],
                                                                                           ScheduledEventId:9,
                                                                                           StartedEventId:11,
                                                                                           Identity:unknown-mac}
  13  2020-04-05T16:35:23-07:00  EventTypeWorkflowExecutionTimedOut                        {TimeoutType:TimeoutTypeStartToClose}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants