最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

temporal randomly some of the activities task are getting stuck forever state : PENDING_ACTIVITY_STATE_SCHEDULED - Stack Overflo

programmeradmin4浏览0评论

i'am using temporal in production and facing a strange issue. randomly some of the activities task are getting stuck forever in the queue and not getting executed and having state : "PENDING_ACTIVITY_STATE_SCHEDULED"

i'am using temporal with cassandra and elastic search.

Temporal Server Version 1.25.1 Temporal UI Version 2.31.2 Cassandra Version : 3 Elasticsearch Version : 7.

it happens more frequently when start many workflows at the same time. for example after staring 1000 workflows 10-20 of activities of them will get stuck in the queue.

the activities stay in that state even after :

  • inspecting the queue (task-queue describe ) and no task in the backlog
  • worker_task_slots_used went down to 0
  • worker_task_slots_available went up to 200 (the default value)
  • no error in the worker logs After restarting the worker the activities are no processed

after restarting the worker and starting new workflows the same worker ignore those activities in the same task queue and start new activities for the new workflows.

this behavior is not reproducible the local and dev environments.

the difference between the production and the local/dev environments is that for CASSANDRE KEYSPACE we have RF 1 in dev and 3 in production.

you wille find join :

  • an event history for a workflow that has a stuck activity (i removed (inputs, search attributes, and result))
  • a screenshot for the stuck activity in the web-ui

{
  "events": [
    {
      "eventId": "1",
      "eventTime": "2025-03-17T10:18:42.343680523Z",
      "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED",
      "taskId": "10486231",
      "workflowExecutionStartedEventAttributes": {
        "workflowType": {
          "name": "NopSkill"
        },
        "parentWorkflowNamespace": "default",
        "parentWorkflowNamespaceId": "ae8e1716-6d04-44d3-8de1-51f7cdc1149e",
        "parentWorkflowExecution": {
          "workflowId": "e61c4a1a-0d10-4039-956f-6df5b9d81805",
          "runId": "b762a42c-4ce0-482f-af56-bfd4beb06a6c"
        },
        "parentInitiatedEventId": "102",
        "taskQueue": {
          "name": "0.0.0_nop_skill"
        },
        "workflowExecutionTimeout": "0s",
        "workflowRunTimeout": "0s",
        "workflowTaskTimeout": "10s",
        "originalExecutionRunId": "73bac04c-5eba-4875-9dd8-70378d7fc1e4",
        "firstExecutionRunId": "73bac04c-5eba-4875-9dd8-70378d7fc1e4",
        "attempt": 1,
        "firstWorkflowTaskBackoff": "0s",
        "header": {},
        "workflowId": "16c6c7a5-0245-3e5c-926a-d293460260eb",
        "rootWorkflowExecution": {
          "workflowId": "e61c4a1a-0d10-4039-956f-6df5b9d81805",
          "runId": "b762a42c-4ce0-482f-af56-bfd4beb06a6c"
        }
      }
    },
    {
      "eventId": "2",
      "eventTime": "2025-03-17T10:18:42.376521963Z",
      "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
      "taskId": "10486235",
      "workflowTaskScheduledEventAttributes": {
        "taskQueue": {
          "name": "0.0.0_nop_skill",
          "kind": "TASK_QUEUE_KIND_NORMAL"
        },
        "startToCloseTimeout": "10s",
        "attempt": 1
      }
    },
    {
      "eventId": "3",
      "eventTime": "2025-03-17T10:18:42.401876577Z",
      "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
      "taskId": "10486238",
      "workflowTaskStartedEventAttributes": {
        "scheduledEventId": "2",
        "identity": "1@skills-85b849dbdc-k9vgg",
        "requestId": "4070dff5-18bb-4826-b394-4688535e0a5d",
        "historySizeBytes": "4408"
      }
    },
    {
      "eventId": "4",
      "eventTime": "2025-03-17T10:18:42.442968707Z",
      "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
      "taskId": "10486242",
      "workflowTaskCompletedEventAttributes": {
        "scheduledEventId": "2",
        "startedEventId": "3",
        "identity": "1@skills-85b849dbdc-k9vgg",
        "workerVersion": {},
        "sdkMetadata": {
          "langUsedFlags": [
            1
          ]
        },
        "meteringMetadata": {}
      }
    },
    {
      "eventId": "5",
      "eventTime": "2025-03-17T10:18:42.443082698Z",
      "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED",
      "taskId": "10486243",
      "activityTaskScheduledEventAttributes": {
        "activityId": "2b8d9770-c390-39fb-b070-d946ca6c4958",
        "activityType": {
          "name": "SendSimplexTask"
        },
        "taskQueue": {
          "name": "0.0.0_nop_skill",
          "kind": "TASK_QUEUE_KIND_NORMAL"
        },
        "header": {},
        "scheduleToCloseTimeout": "0s",
        "scheduleToStartTimeout": "0s",
        "startToCloseTimeout": "10s",
        "heartbeatTimeout": "0s",
        "workflowTaskCompletedEventId": "4",
        "retryPolicy": {
          "initialInterval": "1s",
          "backoffCoefficient": 2,
          "maximumInterval": "100s",
          "maximumAttempts": 10
        }
      }
    },
    {
      "eventId": "6",
      "eventTime": "2025-03-17T10:18:42.471655602Z",
      "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED",
      "taskId": "10486249",
      "activityTaskStartedEventAttributes": {
        "scheduledEventId": "5",
        "identity": "1@skills-85b849dbdc-k9vgg",
        "requestId": "5e3a91b3-052f-4d5c-af63-ceea5f5980ca",
        "attempt": 1,
        "workerVersion": {}
      }
    },
    {
      "eventId": "7",
      "eventTime": "2025-03-17T10:18:42.561327917Z",
      "eventType": "EVENT_TYPE_ACTIVITY_TASK_COMPLETED",
      "taskId": "10486250",
      "activityTaskCompletedEventAttributes": {
        "result": {
          "payloads": [
          ]
        },
        "scheduledEventId": "5",
        "startedEventId": "6",
        "identity": "1@skills-85b849dbdc-k9vgg"
      }
    },
    {
      "eventId": "8",
      "eventTime": "2025-03-17T10:18:42.561347097Z",
      "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED",
      "taskId": "10486251",
      "workflowTaskScheduledEventAttributes": {
        "taskQueue": {
          "name": "1@skills-85b849dbdc-k9vgg:0af62d94-783e-4f05-8ba6-6211a1f05a81",
          "kind": "TASK_QUEUE_KIND_STICKY",
          "normalName": "0.0.0_nop_skill"
        },
        "startToCloseTimeout": "10s",
        "attempt": 1
      }
    },
    {
      "eventId": "9",
      "eventTime": "2025-03-17T10:18:42.586571541Z",
      "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED",
      "taskId": "10486255",
      "workflowTaskStartedEventAttributes": {
        "scheduledEventId": "8",
        "identity": "1@skills-85b849dbdc-k9vgg",
        "requestId": "446f9029-3a63-481c-b7c4-3ad2b3279737",
        "historySizeBytes": "6640"
      }
    },
    {
      "eventId": "10",
      "eventTime": "2025-03-17T10:18:42.628463916Z",
      "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED",
      "taskId": "10486259",
      "workflowTaskCompletedEventAttributes": {
        "scheduledEventId": "8",
        "startedEventId": "9",
        "identity": "1@skills-85b849dbdc-k9vgg",
        "workerVersion": {},
        "meteringMetadata": {}
      }
    },
    {
      "eventId": "11",
      "eventTime": "2025-03-17T10:18:42.628752458Z",
      "eventType": "EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES",
      "taskId": "10486260",
      "upsertWorkflowSearchAttributesEventAttributes": {
        "workflowTaskCompletedEventId": "10",
        "searchAttributes": {
        }
      }
    },
    {
      "eventId": "12",
      "eventTime": "2025-03-17T10:18:42.628881449Z",
      "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED",
      "taskId": "10486261",
      "activityTaskScheduledEventAttributes": {
        "activityId": "9517571b-c4c2-370b-a9c1-b2bd00ff2f8a",
        "activityType": {
          "name": "UpdateUserTask"
        },
        "taskQueue": {
          "name": "0.0.0_nop_skill",
          "kind": "TASK_QUEUE_KIND_NORMAL"
        },
        "header": {},
        "scheduleToCloseTimeout": "0s",
        "scheduleToStartTimeout": "0s",
        "startToCloseTimeout": "10s",
        "heartbeatTimeout": "0s",
        "workflowTaskCompletedEventId": "10",
        "retryPolicy": {
          "initialInterval": "1s",
          "backoffCoefficient": 2,
          "maximumInterval": "100s",
          "maximumAttempts": 10
        }
      }
    },
    {
      "eventId": "13",
      "eventTime": "2025-03-24T17:52:39.020287086Z",
      "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED",
      "taskId": "13631603",
      "workflowExecutionTerminatedEventAttributes": {
        "reason": "Requested from CLI by <unknown-user>",
        "identity": "1@temporal-worker-69b444d7b6-s9pxm@"
      }
    }
  ]
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论