SCRIPT KILL
SCRIPT KILL
- Group
- Scripting and functions
- Complexity
- O(1)
- Arity
- 2 (exactly, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
SCRIPT KILL stops the Lua script or function that is running on another
connection, for example one stuck in a loop. The script’s caller gets the
error ERR Script killed by user with SCRIPT KILL.... Once the running script
has run longer than busy-reply-threshold, other clients get BUSY errors,
and SCRIPT KILL is one of the few commands they can still send.
A script that has already written cannot be stopped this way, since stopping
it halfway would break atomicity. Wait for it to finish, or stop the server
with SHUTDOWN NOSAVE.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| The script was stopped | Simple string OK |
Simple string OK |
| No script is running | Error NOTBUSY No scripts in execution right now. |
Error |
| The script has written | Error UNKILLABLE Sorry the script already executed write commands against the dataset. ... |
Error |
Examples
Section titled “Examples”127.0.0.1:6379> SCRIPT KILL(error) NOTBUSY No scripts in execution right now.Compatibility
Section titled “Compatibility”Same replies as Redis 7 and Valkey 8, with one difference: SCRIPT KILL and
FUNCTION KILL each stop either a script or a
function, where Redis lets SCRIPT KILL stop only scripts run with EVAL and
FUNCTION KILL only functions.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.