ERR
redis
runtime_error
ai_generated
true
运行脚本时出错(调用 f_<sha>):@user_script:<行>:-BUSY Redis 正忙于运行脚本。您只能调用 SCRIPT KILL 或 SHUTDOWN NOSAVE。
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.
ID: redis/lua-script-deadlock-timeout
85%修复率
90%置信度
1证据数
2023-10-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.2.0 | active | — | — | — |
| 7.4.0 | active | — | — | — |
| 8.0.0 | active | — | — | — |
根因分析
Lua 脚本超过 lua-time-limit(默认 5 秒),阻塞所有其他命令;只能通过 SCRIPT KILL 或 SHUTDOWN NOSAVE 恢复。
English
Lua script exceeded lua-time-limit (default 5s), blocking all other commands; only SCRIPT KILL or SHUTDOWN NOSAVE can recover.
官方文档
https://redis.io/docs/manual/programmability/eval-intro/解决方案
-
终止脚本:redis-cli SCRIPT KILL。如果脚本未执行任何写操作,这有效。如果已写入,请改用 SHUTDOWN NOSAVE。
-
通过优化 Lua 脚本防止未来发生:使用局部变量、避免长循环,并设置更高的 lua-time-limit(例如 CONFIG SET lua-time-limit 10000)。
无效尝试
常见但无效的做法:
-
90% 失败
Restarting the Redis server with SHUTDOWN (without NOSAVE) will fail because the script blocks the SHUTDOWN command itself; only SHUTDOWN NOSAVE works.
-
100% 失败
Sending any other command (like PING) will fail because all commands are blocked; only SCRIPT KILL or SHUTDOWN NOSAVE are allowed.