Sleep in workflow

TLDR; This works as designed.

Workflow code is executed only when a worker process receives so called workflow task. The workflow task has a timeout (default is 10 seconds). See this post that explains the workflow task.

In your case, when a thread is blocked using the prohibited method (instead of supported Workflow.sleep) the deadlock detector aborts the workflow task. When a task is aborted WorkflowTaskFailed is recorded into the history. When you kill the worker, nothing is reported back to the service, so the workflow task timeout fires, and WorkflowTaskTimedOut is recorded into the history. In both cases, the task is retried to ensure that workflow continues execution.

1 Like