{
  "id": "redis/lua-script-deadlock-detected",
  "signature": "ERR LUA script deadlock detected: script <sha> blocked for <seconds> seconds",
  "signature_zh": "检测到 LUA 脚本死锁：脚本 <sha> 阻塞了 <seconds> 秒",
  "regex": "ERR LUA script deadlock detected: script [a-f0-9]+ blocked for \\d+ seconds",
  "domain": "redis",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A Lua script entered an infinite loop or blocked on a resource (e.g., Redis.call inside a loop), exceeding the lua-time-limit and triggering a deadlock warning.",
  "root_cause_type": "generic",
  "root_cause_zh": "Lua 脚本进入无限循环或在资源上阻塞（例如，循环内的 Redis.call），超过了 lua-time-limit，触发死锁警告。",
  "versions": [
    {
      "version": "6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Only works if script hasn't written data; otherwise, Redis forces shutdown.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Masks the problem; script may still hang indefinitely, blocking other operations.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Causes downtime and potential data loss; does not fix the script logic.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Run 'SCRIPT KILL' if the script has not performed any writes (check with 'SCRIPT DEBUG'). If writes occurred, use 'SHUTDOWN NOSAVE' to stop Redis.",
      "success_rate": 0.85,
      "how": "Run 'SCRIPT KILL' if the script has not performed any writes (check with 'SCRIPT DEBUG'). If writes occurred, use 'SHUTDOWN NOSAVE' to stop Redis.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a loop counter or use 'redis.setresp(3)' to limit iterations. Example: 'local i = 0; while i < 1000 do redis.call(\"PING\"); i = i + 1 end'.",
      "success_rate": 0.9,
      "how": "Add a loop counter or use 'redis.setresp(3)' to limit iterations. Example: 'local i = 0; while i < 1000 do redis.call(\"PING\"); i = i + 1 end'.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "如果脚本未执行任何写入（使用 'SCRIPT DEBUG' 检查），运行 'SCRIPT KILL'。如果已写入，使用 'SHUTDOWN NOSAVE' 停止 Redis。",
    "添加循环计数器或使用 'redis.setresp(3)' 限制迭代次数。示例：'local i = 0; while i < 1000 do redis.call(\"PING\"); i = i + 1 end'。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://redis.io/docs/latest/programmability/eval-intro/",
  "official_doc_section": null,
  "error_code": "ERM",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.78,
  "resolvable": "partial",
  "first_seen": "2023-05-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}