{
  "id": "redis/lua-script-deadlock-timeout",
  "signature": "ERR Error running script (call to f_<sha>): @user_script: <line>: -BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.",
  "signature_zh": "运行脚本时出错（调用 f_<sha>）：@user_script：<行>：-BUSY Redis 正忙于运行脚本。您只能调用 SCRIPT KILL 或 SHUTDOWN NOSAVE。",
  "regex": "ERR Error running script \\(call to f_[a-f0-9]+\\): @user_script: \\d+: -BUSY Redis is busy running a script",
  "domain": "redis",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Lua script exceeded lua-time-limit (default 5s), blocking all other commands; only SCRIPT KILL or SHUTDOWN NOSAVE can recover.",
  "root_cause_type": "generic",
  "root_cause_zh": "Lua 脚本超过 lua-time-limit（默认 5 秒），阻塞所有其他命令；只能通过 SCRIPT KILL 或 SHUTDOWN NOSAVE 恢复。",
  "versions": [
    {
      "version": "7.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Restarting the Redis server with SHUTDOWN (without NOSAVE) will fail because the script blocks the SHUTDOWN command itself; only SHUTDOWN NOSAVE works.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Sending any other command (like PING) will fail because all commands are blocked; only SCRIPT KILL or SHUTDOWN NOSAVE are allowed.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Kill the script: redis-cli SCRIPT KILL. This works if the script has not performed any write operations. If it has written, use SHUTDOWN NOSAVE instead.",
      "success_rate": 0.9,
      "how": "Kill the script: redis-cli SCRIPT KILL. This works if the script has not performed any write operations. If it has written, use SHUTDOWN NOSAVE instead.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Prevent future occurrences by optimizing Lua scripts: use local variables, avoid long loops, and set lua-time-limit higher (e.g., CONFIG SET lua-time-limit 10000).",
      "success_rate": 0.8,
      "how": "Prevent future occurrences by optimizing Lua scripts: use local variables, avoid long loops, and set lua-time-limit higher (e.g., CONFIG SET lua-time-limit 10000).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "终止脚本：redis-cli SCRIPT KILL。如果脚本未执行任何写操作，这有效。如果已写入，请改用 SHUTDOWN NOSAVE。",
    "通过优化 Lua 脚本防止未来发生：使用局部变量、避免长循环，并设置更高的 lua-time-limit（例如 CONFIG SET lua-time-limit 10000）。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://redis.io/docs/manual/programmability/eval-intro/",
  "official_doc_section": null,
  "error_code": "ERR",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-10-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}