Heartbeat timeout in Activity

Hi!

May be this question was asked many times in chats. But not found direct answer in documentation.

Activity has Heartbeat timeout parameter. Please describe how it works in generic and in specific cases like:

  1. Activity don’t have retry and task is failed inside heartbeat period and what if outside

  2. How heartbeat timeout correlated with other timeouts: schedulertoclose/start so on…

Thanks!

  1. Activity don’t have retry and task is failed inside heartbeat period and what if outside

In Temporal every activity gets a default retry policy if not specified explicitly. To disable retries RetryOptions.maximumAttempts should be set to 1. Cadence did not provide the default retry policy.

If an activity didn’t heartbeat or complete within a configured heartbeat interval the timeout is triggered and it is either retried (if retry policy says so) or the timeout is delivered to the workflow. Note that the timeout doesn’t stop the activity execution by the worker. When the worker tries to report the activity result to the server it is going to receive NOT_FOUND failure as the information about the timed out activity is removed from the service.

If an activity completes within a heartbeat timeout the completion is delivered to the workflow.

If an activity fails within a heartbeat timeout it is either retried (if retry policy says so) or the failure is delivered to the workflow.

  1. How heartbeat timeout correlated with other timeouts: schedulertoclose/start so on…

Heartbeat is expected to be shorter than StartToClose timeout. The StartToClose is expected to be the same or shorter than ScheduleToClose. ScheduleToStart in the majority of the situations should not be specified and default to ScheduleToClose.

2 Likes