Skip to content

Commit 9c3efae

Browse files
Fix childWF decision panic after reset due to runID change (#1118)
1 parent 67ee9b9 commit 9c3efae

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

internal/internal_event_handlers.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,11 @@ func (wc *workflowEnvironmentImpl) RegisterCancelHandler(handler func()) {
374374
func (wc *workflowEnvironmentImpl) ExecuteChildWorkflow(
375375
params executeWorkflowParams, callback resultHandler, startedHandler func(r WorkflowExecution, e error)) error {
376376
if params.workflowID == "" {
377-
params.workflowID = wc.workflowInfo.WorkflowExecution.RunID + "_" + wc.GenerateSequenceID()
377+
if wc.workflowInfo.OriginalRunId != ""{
378+
params.workflowID = wc.workflowInfo.OriginalRunId + "_" + wc.GenerateSequenceID()
379+
}else{
380+
params.workflowID = wc.workflowInfo.WorkflowExecution.RunID + "_" + wc.GenerateSequenceID()
381+
}
378382
}
379383
memo, err := getWorkflowMemo(params.memo, wc.dataConverter)
380384
if err != nil {

internal/internal_task_handlers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ func (wth *workflowTaskHandlerImpl) createWorkflowContext(task *s.PollForDecisio
633633
ID: workflowID,
634634
RunID: runID,
635635
},
636+
OriginalRunId: attributes.GetOriginalExecutionRunId(),
636637
WorkflowType: flowWorkflowTypeFrom(*task.WorkflowType),
637638
TaskListName: taskList.GetName(),
638639
ExecutionStartToCloseTimeoutSeconds: attributes.GetExecutionStartToCloseTimeoutSeconds(),

internal/workflow.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ func getWorkflowHeader(ctx Context, ctxProps []ContextPropagator) *s.Header {
779779
// WorkflowInfo information about currently executing workflow
780780
type WorkflowInfo struct {
781781
WorkflowExecution WorkflowExecution
782+
OriginalRunId string // The original runID before resetting. Using it instead of current runID can make workflow decision determinstic after reset
782783
WorkflowType WorkflowType
783784
TaskListName string
784785
ExecutionStartToCloseTimeoutSeconds int32

0 commit comments

Comments
 (0)