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

Added debug information for decision timeout handling #5674

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions service/history/task/timer_active_task_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ func (t *timerActiveTaskExecutor) executeActivityTimeoutTask(
}
defer func() { release(retError) }()

domainName, err := t.shard.GetDomainCache().GetDomainName(task.DomainID)
if err != nil {
return fmt.Errorf("unable to find domainID: %v, err: %v", task.DomainID, err)
}

mutableState, err := loadMutableStateForTimerTask(ctx, wfContext, task, t.metricsClient, t.logger)
if err != nil {
return err
Expand All @@ -281,6 +286,11 @@ func (t *timerActiveTaskExecutor) executeActivityTimeoutTask(
return nil
}

wfType := mutableState.GetWorkflowType()
if wfType == nil {
return fmt.Errorf("unable to find workflow type, task %s", task)
}

timerSequence := execution.NewTimerSequence(mutableState)
referenceTime := t.shard.GetTimeSource().Now()
resurrectionCheckMinDelay := t.config.ResurrectionCheckMinDelay(mutableState.GetDomainEntry().GetInfo().Name)
Expand Down Expand Up @@ -398,7 +408,18 @@ Loop:
mutableState.GetExecutionInfo().DomainID,
metrics.TimerActiveTaskActivityTimeoutScope,
timerSequenceID.TimerType,
metrics.WorkflowTypeTag(wfType.GetName()),
)

t.logger.Info("Activity timed out",
tag.WorkflowDomainName(domainName),
tag.WorkflowDomainID(task.GetDomainID()),
tag.WorkflowID(task.GetWorkflowID()),
tag.WorkflowRunID(task.GetRunID()),
tag.ScheduleAttempt(task.ScheduleAttempt),
tag.FailoverVersion(task.GetVersion()),
)

if _, err := mutableState.AddActivityTaskTimedOutEvent(
activityInfo.ScheduleID,
activityInfo.StartedID,
Expand Down Expand Up @@ -435,6 +456,11 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask(
}
defer func() { release(retError) }()

domainName, err := t.shard.GetDomainCache().GetDomainName(task.DomainID)
if err != nil {
return fmt.Errorf("unable to find domainID: %v, err: %v", task.DomainID, err)
}

mutableState, err := loadMutableStateForTimerTask(ctx, wfContext, task, t.metricsClient, t.logger)
if err != nil {
return err
Expand All @@ -443,6 +469,11 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask(
return nil
}

wfType := mutableState.GetWorkflowType()
if wfType == nil {
return fmt.Errorf("unable to find workflow type, task %s", task)
}

scheduleID := task.EventID
decision, ok := mutableState.GetDecisionInfo(scheduleID)
if !ok {
Expand All @@ -464,13 +495,14 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask(
if isStickyDecision {
decisionTypeTag = stickyDecisionTypeTag
}
tags := []metrics.Tag{metrics.WorkflowTypeTag(wfType.GetName()), decisionTypeTag}
switch execution.TimerTypeFromInternal(types.TimeoutType(task.TimeoutType)) {
case execution.TimerTypeStartToClose:
t.emitTimeoutMetricScopeWithDomainTag(
mutableState.GetExecutionInfo().DomainID,
metrics.TimerActiveTaskDecisionTimeoutScope,
execution.TimerTypeStartToClose,
decisionTypeTag,
tags...,
)
if _, err := mutableState.AddDecisionTaskTimedOutEvent(
decision.ScheduleID,
Expand All @@ -488,6 +520,7 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask(

if !isStickyDecision {
t.logger.Warn("Potential lost normal decision task",
tag.WorkflowDomainName(domainName),
tag.WorkflowDomainID(task.GetDomainID()),
tag.WorkflowID(task.GetWorkflowID()),
tag.WorkflowRunID(task.GetRunID()),
Expand All @@ -501,7 +534,7 @@ func (t *timerActiveTaskExecutor) executeDecisionTimeoutTask(
mutableState.GetExecutionInfo().DomainID,
metrics.TimerActiveTaskDecisionTimeoutScope,
execution.TimerTypeScheduleToStart,
decisionTypeTag,
tags...,
)
_, err := mutableState.AddDecisionTaskScheduleToStartTimeoutEvent(scheduleID)
if err != nil {
Expand Down