Skip to content

Commit

Permalink
Fix childWF decision panic after reset due to runID change (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng committed Sep 10, 2021
1 parent 67ee9b9 commit 9c3efae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/internal_event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ func (wc *workflowEnvironmentImpl) RegisterCancelHandler(handler func()) {
func (wc *workflowEnvironmentImpl) ExecuteChildWorkflow(
params executeWorkflowParams, callback resultHandler, startedHandler func(r WorkflowExecution, e error)) error {
if params.workflowID == "" {
params.workflowID = wc.workflowInfo.WorkflowExecution.RunID + "_" + wc.GenerateSequenceID()
if wc.workflowInfo.OriginalRunId != ""{
params.workflowID = wc.workflowInfo.OriginalRunId + "_" + wc.GenerateSequenceID()
}else{
params.workflowID = wc.workflowInfo.WorkflowExecution.RunID + "_" + wc.GenerateSequenceID()
}
}
memo, err := getWorkflowMemo(params.memo, wc.dataConverter)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/internal_task_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ func (wth *workflowTaskHandlerImpl) createWorkflowContext(task *s.PollForDecisio
ID: workflowID,
RunID: runID,
},
OriginalRunId: attributes.GetOriginalExecutionRunId(),
WorkflowType: flowWorkflowTypeFrom(*task.WorkflowType),
TaskListName: taskList.GetName(),
ExecutionStartToCloseTimeoutSeconds: attributes.GetExecutionStartToCloseTimeoutSeconds(),
Expand Down
1 change: 1 addition & 0 deletions internal/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ func getWorkflowHeader(ctx Context, ctxProps []ContextPropagator) *s.Header {
// WorkflowInfo information about currently executing workflow
type WorkflowInfo struct {
WorkflowExecution WorkflowExecution
OriginalRunId string // The original runID before resetting. Using it instead of current runID can make workflow decision determinstic after reset
WorkflowType WorkflowType
TaskListName string
ExecutionStartToCloseTimeoutSeconds int32
Expand Down

0 comments on commit 9c3efae

Please sign in to comment.