go.temporal.io/server/common/failure/failure.go

91 LOC · 65 covered · 26 uncovered · 13 ranges · 73 concepts · 8 introducers · 47 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filego.temporal.io/server/service/history/workflow/mutable_state_impl.go · 9930 LOCworkflow/mutable_state_i…go.temporal.io/server/service/history/workflow/task_generator_mock.go · 374 LOCworkflow/task_generator_…workflow_task_completed_handler.go ×1 · 3 introduced LOCworkflow_task_completed_…workflow_task_completed_handler.go ×1 · 10 introduced LOCworkflow_task_completed_…retry.go ×15 · 261 introduced LOCretry.go ×15workflow_task_completed_handler.go ×1 · 8 introduced LOCworkflow_task_completed_…command_attr_validator.go ×1 · 5 introduced LOCcommand_attr_validator.g…TestProcessActivityTimeout_RetryPolicy_RetryTimeout · 0 introduced LOCTestProcessActivityTimeo…workflow_task_completed_handler.go ×1 · 2 introduced LOCworkflow_task_completed_…workflow_task_completed_handler.go ×1 · 2 introduced LOCworkflow_task_completed_…workflow_task_completed_handler.go ×1 · 5 introduced LOCworkflow_task_completed_…api.go ×3 · 18 introduced LOCapi.go ×3workflow_task_completed_handler.go ×9 · 34 introduced LOCworkflow_task_completed_…TestProcessActivityTimeout_RetryPolicy_Retry · 0 introduced LOCTestProcessActivityTimeo…TestProcessActivityTimeout_NoRetryPolicy_Fire · 0 introduced LOCTestProcessActivityTimeo…TestProcessActivityTimeout_RetryPolicy_Fire · 0 introduced LOCTestProcessActivityTimeo…TestRespondActivityTaskFailedByIdSuccess · 0 introduced LOCTestRespondActivityTaskF…timer_queue_active_task_executor.go ×1 · 2 introduced LOCtimer_queue_active_task_…TestWorkflowRunTimeout_Fire · 0 introduced LOCTestWorkflowRunTimeout_F…mutable_state_impl.go ×6 · 28 introduced LOCmutable_state_impl.go ×6workflow_task_completed_handler.go ×1 · 8 introduced LOCworkflow_task_completed_…workflow_task_completed_handler.go ×1 · 12 introduced LOCworkflow_task_completed_…executions.pb.go ×1 · 4 introduced LOCexecutions.pb.go ×1TestRespondActivityTaskFailedSuccess · 0 introduced LOCTestRespondActivityTaskF…TestWorkflowRunTimeout_Cron · 0 introduced LOCTestWorkflowRunTimeout_C…timer_queue_active_task_executor.go ×2 · 6 introduced LOCtimer_queue_active_task_…tags.go ×1 · 3 introduced LOCtags.go ×1mutable_state_impl.go ×1 · 4 introduced LOCmutable_state_impl.go ×1mutable_state_impl.go ×5 · 36 introduced LOCmutable_state_impl.go ×5timer_queue_active_task_executor.go ×2 · 3 introduced LOCtimer_queue_active_task_…timer_queue_active_task_executor.go ×13 · 33 introduced LOCtimer_queue_active_task_…timer_queue_active_task_executor.go ×3 · 7 introduced LOCtimer_queue_active_task_…workflow_task_completed_handler.go ×1 · 2 introduced LOCworkflow_task_completed_…workflow_task_completed_handler.go ×2 · 4 introduced LOCworkflow_task_completed_…workflow_task_completed_handler.go ×1 · 1 introduced LOCworkflow_task_completed_…api.go ×8 · 62 introduced LOCapi.go ×8TestRespondActivityTaskFailedIfTaskCompleted · 0 introduced LOCTestRespondActivityTaskF…history_builder.go ×1 · 5 introduced LOChistory_builder.go ×1TestQueryWorkflow_RejectBasedOnFailed · 0 introduced LOCTestQueryWorkflow_Reject…workflow_task_type.pb.go ×1 · 4 introduced LOCworkflow_task_type.pb.go…valid_SA_field · 0 introduced LOCvalid_SA_fieldretry.go ×1 · 7 introduced LOCretry.go ×1TestRetryActivity_should_clear_per_attempt_fields, TestRetryActivity_should_be_scheduled_when_next_backoff_interval_can_be_calculated · 0 introduced LOCTestRetryActivity_should…mutable_state_impl.go ×1 · 2 introduced LOCmutable_state_impl.go ×1mutable_state_impl.go ×2 · 20 introduced LOCmutable_state_impl.go ×2history_event_util.go ×2 · 38 introduced LOChistory_event_util.go ×2invalid_SA_field · 0 introduced LOCinvalid_SA_fieldhistory_event_util.go ×1 · 19 introduced LOChistory_event_util.go ×1TestImportWorkflowExecution_NoSearchAttributes · 0 introduced LOCTestImportWorkflowExecut…history_event_util.go ×1 · 10 introduced LOChistory_event_util.go ×1Retry_State_Timeout · 0 introduced LOCRetry_State_Timeoutmutable_state_mock.go ×2 · 11 introduced LOCmutable_state_mock.go ×2Retry_State_In_Progress · 0 introduced LOCRetry_State_In_Progresstimer_queue_active_task_executor.go ×1 · 5 introduced LOCtimer_queue_active_task_…timer_queue_active_task_executor.go ×2 · 20 introduced LOCtimer_queue_active_task_…timer_queue_active_task_executor.go ×1 · 5 introduced LOCtimer_queue_active_task_…timer_queue_active_task_executor.go ×3 · 22 introduced LOCtimer_queue_active_task_…failure.go ×1 · 11 introduced LOCfailure.go ×1workflow_resetter.go ×8 · 41 introduced LOCworkflow_resetter.go ×8workflow_resetter.go ×2 · 13 introduced LOCworkflow_resetter.go ×2mutable_state_mock.go ×2 · 26 introduced LOCmutable_state_mock.go ×2workflow_resetter.go ×2 · 14 introduced LOCworkflow_resetter.go ×2workflow_resetter.go ×2 · 4 introduced LOCworkflow_resetter.go ×2failure.go ×1 · 10 introduced LOCfailure.go ×1history_require.go ×13 · 72 introduced LOChistory_require.go ×13history_event_util.go ×1 · 12 introduced LOChistory_event_util.go ×1history_event_util.go ×2 · 33 introduced LOChistory_event_util.go ×2when_retriable_error_provided_should_proceed_to_calculate_backoff_interval · 0 introduced LOCwhen_retriable_error_pro…retry.go ×1 · 2 introduced LOCretry.go ×1failure.go ×1 · 10 introduced LOCfailure.go ×1TestTruncateUTF8 · 0 introduced LOCTestTruncateUTF8failure.go ×1 · 5 introduced LOCfailure.go ×1failure.go ×1 · 2 introduced LOCfailure.go ×1failure.go ×1 · 3 introduced LOCfailure.go ×1failure.go ×6 · 19 introduced LOCfailure.go ×6TestTruncate · introduced test · go.temporal.io/server/common/failure/TestTruncateTestTruncateTestTruncateDepth · introduced test · go.temporal.io/server/common/failure/TestTruncateDepthTestTruncateDepthTestTruncateUTF8 · introduced test · go.temporal.io/server/common/failure/TestTruncateUTF8TestTruncateUTF8TestPrintHistoryEvents · introduced test · go.temporal.io/server/common/testing/historyrequire/TestPrintHistoryEventsTestPrintHistoryEventsTestImportWorkflowExecution_NoSearchAttributes · introduced test · go.temporal.io/server/service/frontend/TestAdminHandlerSuite/TestImportWorkflowExecution_NoSearchAttributesTestImportWorkflowExecut…invalid_SA_alias · introduced test · go.temporal.io/server/service/frontend/TestAdminHandlerSuite/TestImportWorkflowExecution_WithAliasedSearchAttributes/invalid_SA_aliasinvalid_SA_aliasinvalid_SA_field · introduced test · go.temporal.io/server/service/frontend/TestAdminHandlerSuite/TestImportWorkflowExecution_WithAliasedSearchAttributes/invalid_SA_fieldinvalid_SA_fieldvalid_SA_field · introduced test · go.temporal.io/server/service/frontend/TestAdminHandlerSuite/TestImportWorkflowExecution_WithNonAliasedSearchAttributes/valid_SA_fieldvalid_SA_fieldTestRespondWorkflowTaskCompleted_StartChildWorkflow_ExceedsLimit · introduced test · go.temporal.io/server/service/history/TestEngine2Suite/TestRespondWorkflowTaskCompleted_StartChildWorkflow_ExceedsLimitTestRespondWorkflowTaskC…TestCancelTimer_RespondWorkflowTaskCompleted_NoStartTimer · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestCancelTimer_RespondWorkflowTaskCompleted_NoStartTimerTestCancelTimer_RespondW…TestQueryWorkflow_RejectBasedOnFailed · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestQueryWorkflow_RejectBasedOnFailedTestQueryWorkflow_Reject…TestRequestCancel_RespondWorkflowTaskCompleted_NotScheduled · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRequestCancel_RespondWorkflowTaskCompleted_NotScheduledTestRequestCancel_Respon…TestRespondActivityTaskFailedByIdSuccess · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondActivityTaskFailedByIdSuccessTestRespondActivityTaskF…TestRespondActivityTaskFailedIfTaskCompleted · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondActivityTaskFailedIfTaskCompletedTestRespondActivityTaskF…TestRespondActivityTaskFailedSuccess · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondActivityTaskFailedSuccessTestRespondActivityTaskF…TestRespondActivityTaskFailedWithHeartbeatSuccess · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondActivityTaskFailedWithHeartbeatSuccessTestRespondActivityTaskF…TestRespondWorkflowTaskCompletedBadBinary · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondWorkflowTaskCompletedBadBinaryTestRespondWorkflowTaskC…TestRespondWorkflowTaskCompletedBadCommandAttributes · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondWorkflowTaskCompletedBadCommandAttributesTestRespondWorkflowTaskC…TestRespondWorkflowTaskCompletedCompleteWorkflowFailed · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondWorkflowTaskCompletedCompleteWorkflowFailedTestRespondWorkflowTaskC…TestRespondWorkflowTaskCompletedFailWorkflowFailed · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondWorkflowTaskCompletedFailWorkflowFailedTestRespondWorkflowTaskC…TestRespondWorkflowTaskCompletedFailWorkflowSuccess · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondWorkflowTaskCompletedFailWorkflowSuccessTestRespondWorkflowTaskC…TestRespondWorkflowTaskCompletedSingleActivityScheduledAttribute · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestRespondWorkflowTaskCompletedSingleActivityScheduledAttributeTestRespondWorkflowTaskC…TestStarTimer_DuplicateTimerID · introduced test · go.temporal.io/server/service/history/TestEngineSuite/TestStarTimer_DuplicateTimerIDTestStarTimer_DuplicateT…TestProcessActivityTimeout_NoRetryPolicy_Fire · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessActivityTimeout_NoRetryPolicy_FireTestProcessActivityTimeo…TestProcessActivityTimeout_RetryPolicy_Fire · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessActivityTimeout_RetryPolicy_FireTestProcessActivityTimeo…TestProcessActivityTimeout_RetryPolicy_Retry · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessActivityTimeout_RetryPolicy_RetryTestProcessActivityTimeo…TestProcessActivityTimeout_RetryPolicy_RetryTimeout · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessActivityTimeout_RetryPolicy_RetryTimeoutTestProcessActivityTimeo…Retry_Policy_Not_Set · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessSingleActivityTimeoutTask/Retry_Policy_Not_SetRetry_Policy_Not_SetRetry_State_In_Progress · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessSingleActivityTimeoutTask/Retry_State_In_ProgressRetry_State_In_ProgressRetry_State_Timeout · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestProcessSingleActivityTimeoutTask/Retry_State_TimeoutRetry_State_TimeoutTestWorkflowRunTimeout_Cron · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestWorkflowRunTimeout_CronTestWorkflowRunTimeout_C…TestWorkflowRunTimeout_Fire · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestWorkflowRunTimeout_FireTestWorkflowRunTimeout_F…TestWorkflowRunTimeout_Retry · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestWorkflowRunTimeout_RetryTestWorkflowRunTimeout_R…TestWorkflowRunTimeout_WorkflowExpired · introduced test · go.temporal.io/server/service/history/TestTimerQueueActiveTaskExecutorSuite/TestWorkflowRunTimeout_WorkflowExpiredTestWorkflowRunTimeout_W…TestProcessWorkflowTaskTimeout_AttemptMismatch · introduced test · go.temporal.io/server/service/history/TestTimerQueueStandbyTaskExecutorSuite/TestProcessWorkflowTaskTimeout_AttemptMismatchTestProcessWorkflowTaskT…Per_workflow_buffer_overflow_terminates_the_workflow · introduced test · go.temporal.io/server/service/history/api/respondworkflowtaskcompleted/TestWorkflowTaskCompletedHandlerSuite/TestWorkflowTaskCompletionPagination/Per_workflow_buffer_overflow_terminates_the_workflowPer_workflow_buffer_over…TestFailInflightActivity · introduced test · go.temporal.io/server/service/history/ndc/TestWorkflowResetterSuite/TestFailInflightActivityTestFailInflightActivityTestFailWorkflowTask_WorkflowTaskScheduled · introduced test · go.temporal.io/server/service/history/ndc/TestWorkflowResetterSuite/TestFailWorkflowTask_WorkflowTaskScheduledTestFailWorkflowTask_Wor…TestFailWorkflowTask_WorkflowTaskStarted · introduced test · go.temporal.io/server/service/history/ndc/TestWorkflowResetterSuite/TestFailWorkflowTask_WorkflowTaskStartedTestFailWorkflowTask_Wor…TestWorkflowRestartAfterExecutionTimeout · introduced test · go.temporal.io/server/service/history/ndc/TestWorkflowResetterSuite/TestWorkflowRestartAfterExecutionTimeoutTestWorkflowRestartAfter…TestRetryActivity_next_retry_delay_should_override_max_interval · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_next_retry_delay_should_override_max_intervalTestRetryActivity_next_r…TestRetryActivity_should_be_scheduled_when_next_backoff_interval_can_be_calculated · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_should_be_scheduled_when_next_backoff_interval_can_be_calculatedTestRetryActivity_should…TestRetryActivity_should_be_scheduled_when_next_retry_delay_is_set · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_should_be_scheduled_when_next_retry_delay_is_setTestRetryActivity_should…TestRetryActivity_should_clear_per_attempt_fields · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_should_clear_per_attempt_fieldsTestRetryActivity_should…TestRetryActivity_when_task_can_not_be_generated_should_fail · introduced test · go.temporal.io/server/service/history/workflow/TestMutableStateRetryActivitySuite/TestRetryActivity_when_task_can_not_be_generated_should_failTestRetryActivity_when_t…when_non-retriable_error_provided_should_fail_with_non_retriable_failure · introduced test · go.temporal.io/server/service/history/workflow/Test_NonRetriableErrors/when_non-retriable_error_provided_should_fail_with_non_retriable_failurewhen_non-retriable_error…when_retriable_error_provided_should_proceed_to_calculate_backoff_interval · introduced test · go.temporal.io/server/service/history/workflow/Test_NonRetriableErrors/when_retriable_error_provided_should_proceed_to_calculate_backoff_intervalwhen_retriable_error_pro…Focused file · go.temporal.io/server/common/failure/failure.go · 91 LOCfailure/failure.go

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 package failure
2
3 import (
4 commonpb "go.temporal.io/api/common/v1"
5 enumspb "go.temporal.io/api/enums/v1"
6 failurepb "go.temporal.io/api/failure/v1"
7 "go.temporal.io/server/common/util"
8 )
9
10 const (
11 failureSourceServer = "Server"
12 )
13
14 > func NewServerFailure(message string, nonRetryable bool) *failurepb.Failure { failure.go ×1
15 > f := &failurepb.Failure{
16 > Message: message,
17 > FailureInfo: &failurepb.Failure_ServerFailureInfo{ServerFailureInfo: &failurepb.ServerFailureInfo{
18 > NonRetryable: nonRetryable,
19 > }},
20 > }
21 >
22 > return f
23 > }
24
25 > func NewResetWorkflowFailure(message string, lastHeartbeatDetails *commonpb.Payloads) *failurepb.Failure { failure.go ×1
26 > f := &failurepb.Failure{
27 > Message: message,
28 > FailureInfo: &failurepb.Failure_ResetWorkflowFailureInfo{ResetWorkflowFailureInfo: &failurepb.ResetWorkflowFailureInfo{
29 > LastHeartbeatDetails: lastHeartbeatDetails,
30 > }},
31 > }
32 >
33 > return f
34 > }
35
36 > func NewTimeoutFailure(message string, timeoutType enumspb.TimeoutType) *failurepb.Failure { failure.go ×1
37 > f := &failurepb.Failure{
38 > Message: message,
39 > Source: failureSourceServer,
40 > FailureInfo: &failurepb.Failure_TimeoutFailureInfo{TimeoutFailureInfo: &failurepb.TimeoutFailureInfo{
41 > TimeoutType: timeoutType,
42 > }},
43 > }
44 >
45 > return f
46 > }
47
48 > func Truncate(f *failurepb.Failure, maxSize int) *failurepb.Failure { failure.go ×1
49 > return TruncateWithDepth(f, maxSize, 20)
50 > }
51
52 > func TruncateWithDepth(f *failurepb.Failure, maxSize, maxDepth int) *failurepb.Failure { failure.go ×6
53 > if f == nil {
54 return nil
55 }
56
57 // note that bytes are given to earlier calls first, so call in order of importance
58 > trunc := func(s string) string { failure.go ×6
59 > s = util.TruncateUTF8(s, maxSize)
60 > maxSize -= len(s)
61 > if s != "" {
62 > maxSize -= 4 // account for proto overhead
63 > }
64 > return s
65 }
66
67 > newFailure := &failurepb.Failure{} failure.go ×6
68 >
69 > // Keep failure info for ApplicationFailureInfo and for ServerFailureInfo to persist NonRetryable flag.
70 > if i := f.GetApplicationFailureInfo(); i != nil {
71 > newFailure.FailureInfo = &failurepb.Failure_ApplicationFailureInfo{ApplicationFailureInfo: &failurepb.ApplicationFailureInfo{ mutable_state_impl.go ×2
72 > NonRetryable: i.NonRetryable,
73 > Type: trunc(i.Type),
74 > }}
75 > maxSize -= 8 // account for proto overhead
76 > } else if i := f.GetServerFailureInfo(); i != nil { failure.go ×6
77 > newFailure.FailureInfo = &failurepb.Failure_ServerFailureInfo{ServerFailureInfo: &failurepb.ServerFailureInfo{ failure.go ×1
78 > NonRetryable: i.NonRetryable,
79 > }}
80 > maxSize -= 4 // account for proto overhead
81 > }
82
83 > newFailure.Source = trunc(f.Source) failure.go ×6
84 > newFailure.Message = trunc(f.Message)
85 > newFailure.StackTrace = trunc(f.StackTrace)
86 > if f.Cause != nil && maxSize > 4 && maxDepth > 0 {
87 > newFailure.Cause = TruncateWithDepth(f.Cause, maxSize-4, maxDepth-1) failure.go ×1
88 > }
89
90 > return newFailure failure.go ×6
91 }