{
  "id": "elasticsearch/task-cancellation-exception",
  "signature": "TaskCancellationException: task [id:12345] cancelled with reason [timeout] while waiting for completion",
  "signature_zh": "TaskCancellationException: 任务[id:12345]因超时被取消，等待完成中",
  "regex": "TaskCancellationException: task \\[id:\\d+\\] cancelled with reason \\[timeout\\] while waiting for completion",
  "domain": "elasticsearch",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A long-running task (e.g., reindex, snapshot) exceeded the configured timeout and was forcibly cancelled by the cluster.",
  "root_cause_type": "generic",
  "root_cause_zh": "长时间运行的任务（如重新索引、快照）超过了配置的超时时间，被集群强制取消。",
  "versions": [
    {
      "version": "Elasticsearch 7.17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Elasticsearch 8.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Elasticsearch 8.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing task timeout in elasticsearch.yml (e.g., `task.timeout: 60m`) without analyzing actual task duration",
      "why_fails": "This may mask underlying performance issues (e.g., slow disk, insufficient memory) and cause cascading failures.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Restarting the cluster to clear all tasks",
      "why_fails": "Restarting drops all ongoing tasks, but the error will reoccur if the root cause (e.g., slow shard recovery) is not addressed.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting `task.timeout: 0` to disable timeout",
      "why_fails": "This can lead to indefinite task hangs and resource exhaustion, as the cluster will never cancel stuck tasks.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the timeout for the specific task via API, e.g., `POST _tasks/cancel?actions=cluster:admin/reindex&timeout=2h`",
      "success_rate": 0.8,
      "how": "Increase the timeout for the specific task via API, e.g., `POST _tasks/cancel?actions=cluster:admin/reindex&timeout=2h`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Optimize the task by reducing batch size: for reindex, set `{\"source\": {\"size\": 500}, \"dest\": {\"index\": \"new_index\"}}`",
      "success_rate": 0.85,
      "how": "Optimize the task by reducing batch size: for reindex, set `{\"source\": {\"size\": 500}, \"dest\": {\"index\": \"new_index\"}}`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase `search.max_buckets` and `search.max_buckets_per_cluster` if the task involves heavy aggregation",
      "success_rate": 0.75,
      "how": "Increase `search.max_buckets` and `search.max_buckets_per_cluster` if the task involves heavy aggregation",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "通过API增加特定任务的超时时间，例如：`POST _tasks/cancel?actions=cluster:admin/reindex&timeout=2h`",
    "通过减少批量大小优化任务：对于重新索引，设置`{\"source\": {\"size\": 500}, \"dest\": {\"index\": \"new_index\"}}`",
    "如果任务涉及大量聚合，增加`search.max_buckets`和`search.max_buckets_per_cluster`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html",
  "official_doc_section": null,
  "error_code": "TASK_CANCELLED",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}