## TL;DR
A Lua script is hogging the single thread: Redis rejects other commands with BUSY until it finishes. If the script is not write-heavy, run `SCRIPT KILL`; otherwise wait it out, then rewrite the script to be short. BUSY clears once the script ends.

## Error
```text
redis: BUSY Redis is busy running a script
```

## Steps
1. Check what is running: the BUSY error means a script is executing; identify it from your application logs or the slow log. Expected: the offending script named.
2. Kill it if safe: run `SCRIPT KILL` to abort a script that has not yet written. Expected: the script aborts and BUSY clears (kill fails if the script already wrote; then you must wait).
3. Wait it out if kill refuses: the script will finish; monitor until commands succeed again. Expected: normal operation resumes.
4. Rewrite the script: keep Lua scripts to milliseconds (small key counts, no unbounded loops), and move heavy work out of Redis. Expected: no script ever blocks the server noticeably.
5. Add a timeout mindset: scripts have no preemption, so treat every script as a critical section. Expected: future scripts are reviewed for runtime before deploy.

## When to use
- Commands fail with BUSY during script execution
- After deploying a new Lua script
- Designing Redis-side logic

## When not to use
- Slow non-script commands (command optimization)
- A script that already finished (the error is transient)

## Tool compatibility
- Redis Lua scripting, `SCRIPT KILL`, slow log

## Variant phrasings
### redis script kill not working
Kill only works before the script writes; after a write you must wait.

### lua script blocking redis
Rewrite it short; Redis scripts run atomically on the single thread.

## Why it happens
Redis executes Lua scripts atomically on its single main thread with no preemption. A script that loops over millions of keys blocks every other client until it returns, and BUSY is the server telling everyone else to wait.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_wOtdgAG3Nx1S_GarRlcXrQ
