Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

SCRIPT KILL

Last updated
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.

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
127.0.0.1:6379> SCRIPT KILL
(error) NOTBUSY No scripts in execution right now.

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.

FUNCTION KILL, EVAL, SHUTDOWN