<feed xmlns='http://www.w3.org/2005/Atom'>
<title>redis.git/src/script_lua.c, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/atom/src/script_lua.c?h=master</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/atom/src/script_lua.c?h=master'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/'/>
<updated>2026-07-20T18:00:42Z</updated>
<entry>
<title>Strip CRLF from error and simple string replies (#15496)</title>
<updated>2026-07-20T18:00:42Z</updated>
<author>
<name>YaacovHazan</name>
<email>31382944+YaacovHazan@users.noreply.github.com</email>
</author>
<published>2026-07-20T18:00:42Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=e1cc3dc268a5ff20eecbdb530483fd692c3dbc6e'/>
<id>urn:sha1:e1cc3dc268a5ff20eecbdb530483fd692c3dbc6e</id>
<content type='text'>
Because in some cases, the client put \r\n in the command parameters.
When Redis returns these parameters to the client via an error reply,
the presence of \r\n in the middle can cause the client to only parse
the portion before the \r\n when handling the error reply. This disrupts
the protocol parsing and ultimately causes the connection to become
stuck.

Co-authored-by: debing.sun &lt;debing.sun@redis.com&gt;</content>
</entry>
<entry>
<title>Fix client output buffer memory tracking not accounting for copy-avoided bulk string references (#14934)</title>
<updated>2026-05-06T01:46:17Z</updated>
<author>
<name>debing.sun</name>
<email>debing.sun@redis.com</email>
</author>
<published>2026-05-06T01:46:17Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=05859cdd7ecd847c14403383f166783d8b7aee78'/>
<id>urn:sha1:05859cdd7ecd847c14403383f166783d8b7aee78</id>
<content type='text'>
## Problem

After #14608 (Reply Copy Avoidance), when copy avoidance kicks in, bulk
string replies are sent by reference instead of being copied into the
output buffer.
The referenced bytes are not counted in  `reply_bytes`, which causes:

1. `getClientOutputBufferMemoryUsage()` underestimates the actual memory
usage, so output buffer limits may not be triggered in time, allowing
clients to consume unbounded memory.
2. Client eviction does not account for the referenced bytes, making it
ineffective when copy avoidance is used.
3. `omem` reported in `CLIENT LIST` / `CLIENT INFO` does not reflect the
true output buffer memory footprint.

## Solution

Track the bytes of referenced bulk strings in the output buffer with two
per-client counters:

1. reply_bytes_shared - the logical size of all BULK_STR_REF payloads in
the output buffer.
   Updated incrementally whenever a reference is added/removed.
Represents memory the client is "charged" for even though it is shared
with the keyspace.

2. reply_bytes_unshared — the subset of the above where the referenced
object's refcount == 1 (i.e. the key has been deleted from the
keyspace), so the memory is kept alive solely by this client's output
buffer and would actually be freed on disconnect.
Maintained as a lazy cache refreshed via
updateClientUnsharedReplyBytes().

## Info field

CLIENT LIST / CLIENT INFO — two new fields, plus refined semantics for
existing ones:

Field | Meaning
-- | --
omem | (semantics changed) logical output-buffer memory, now including
shared memory referenced from the keyspace. Still
excludes client-&gt;buf so static clients show 0.
omem-shared | (new) shared output-buffer memory (referenced bulk
strings, not solely owned by this client).
omem-unshared | (new) unshared output-buffer memory (referenced bulk
strings solely owned by this client; freed on disconnect).
tot-mem | (semantics refined) actual memory usage —
includes omem-unshared, excludes omem-shared to avoid double-counting
keyspace memory.

INFO memory — two new fields mirroring the above:

Field | Meaning
-- | --
mem_clients_normal | (semantics changed) actual memory usage of normal
clients (includes unshared, excludes shared).
mem_clients_normal_shared | (new) aggregate shared output-buffer memory
across normal clients.
mem_clients_normal_unshared | (new) aggregate unshared output-buffer
memory across normal clients.

MEMORY STATS — schema extended with the matching keys:

Field | Meaning
-- | --
clients.normal.shared | (new) aggregate shared output-buffer memory
across normal clients.
clients.normal.unshared | (new) aggregate unshared output-buffer memory
across normal clients.

## Bug Fix
Fix missing closeClientOnOutputBufferLimitReached() call when adding a
referenced robj to the reply

---------

Co-authored-by: oranagra &lt;oran@redislabs.com&gt;</content>
</entry>
<entry>
<title>Fix ACL OOB for wrong-arity KEYNUM commands (#14847)</title>
<updated>2026-03-19T01:30:56Z</updated>
<author>
<name>Zijie Zhao</name>
<email>zzjas98@gmail.com</email>
</author>
<published>2026-03-19T01:30:56Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=c4d74587b55383354f53a5c61bd313ccf7867f4b'/>
<id>urn:sha1:c4d74587b55383354f53a5c61bd313ccf7867f4b</id>
<content type='text'>
`luaRedisAclCheckCmdPermissionsCommand` and
`RM_ACLCheckCommandPermissions` now call `commandCheckArity()` to check
command arity before calling `ACLCheckAllUserCommandPerm`, matching the
behavior of `processCommand`, `scriptCall`, and `RM_Call`. Without this,
KEYNUM keyspec commands like EVAL with wrong arity cause out-of-bounds
argv access during key extraction.

Also fix KEYNUM index calculation (`first + keynumidx`) and add a bounds
check in genericGetKeys().

Add scripting and module ACL tests for wrong-arity `EVAL` to lock in the
non-crashing behavior.

Fixes #14843 </content>
</entry>
<entry>
<title>Redact user input in selected logs. (#14748)</title>
<updated>2026-01-29T15:42:19Z</updated>
<author>
<name>RoyBenMoshe</name>
<email>112958533+RoyBenMoshe@users.noreply.github.com</email>
</author>
<published>2026-01-29T15:42:19Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=bf6287d0870df3e9365658f9a5948631c10edf46'/>
<id>urn:sha1:bf6287d0870df3e9365658f9a5948631c10edf46</id>
<content type='text'>
This PR continues the work #14645, to further ensure sensitive user
data is not exposed in logs when hide_user_data_from_log is enabled.

- Redact empty key notices during RDB load.
- Redact key names in eviction/expiration debug logs.
- Block DEBUG SCRIPT output and suppress raw string dump in crash object
debug when redaction is enabled.
- Redact malformed MODULE LOAD argument snippets and unresolved module
configuration logs.
- Redact empty key notices during RDB load.
- Redact key names during Lua globals allow‑list warnings.</content>
</entry>
<entry>
<title>Lua script can be executed in the context of another user (CVE-2025-46818)</title>
<updated>2025-10-30T05:02:49Z</updated>
<author>
<name>Ozan Tezcan</name>
<email>ozantezcan@gmail.com</email>
</author>
<published>2025-06-23T09:10:12Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=a3ae6cb0d6e7acf9b5f4c9a1f0943913140d7527'/>
<id>urn:sha1:a3ae6cb0d6e7acf9b5f4c9a1f0943913140d7527</id>
<content type='text'>
</content>
</entry>
<entry>
<title>RED-135816: Lookahead pre-fetching (#14440)</title>
<updated>2025-10-22T16:16:32Z</updated>
<author>
<name>debing.sun</name>
<email>debing.sun@redis.com</email>
</author>
<published>2025-10-22T16:16:32Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=235e688b010b38496ea1de06b0bfc2786b1ebc63'/>
<id>urn:sha1:235e688b010b38496ea1de06b0bfc2786b1ebc63</id>
<content type='text'>
## Problem and Motivation
Currently, the client only parses one command, then executes it, then
parses new commands until the querybuf is consumed. Doing it this way
means we cannot perform memory prefetch when IO threads are not enabled,
and when IO threads are enabled, we can only parse the first command in
the IO thread, while the remaining command parsing still needs to be
done in the main thread.

This describes a limitation in the current Redis command processing
pipeline where:

Without IO threads: Commands are parsed and executed one by one
sequentially, preventing memory prefetching optimizations
With IO threads: Only the first command gets parsed in the IO thread,
but subsequent commands from the same client's query buffer must still
be parsed in the main thread

## Solution Overview

**Core Innovation**: Parse multiple user commands in advance through a
lookahead pipeline.

**Key Insight**: Since Redis already parses commands to extract keys, we
can do this parsing earlier and memory prefetch operations before the
command reaches execution, allowing multiple I/O operations to run in
parallel.

The bulk of the PR is a redesign of the command processing flow for both
standalone commands and transactional commands.

### High Level Command Processing Flow

#### Before This PR (processInputBuffer())

- While there is data in the client's query buffer:
- Read the data and try to parse a complete command
(processInlineBuffer() or processMultibulkBuffer()).
  - If the command is incomplete, exit and wait for more data.
- The Command is complete. Process and potentially execute it
(processCommandAndResetClient(), processCommand()):
    - Prepare for the next command (commandProcessed()).

### Major Changes in the Client's Structure

To support the new command processing flow:

- **New pendingCommand structure**: Since the previous flow processed
commands one at a time, it used the client structure to hold the current
(and only) parsed command arguments (argv/argc) and other metadata. In
the new design, multiple commands are processed, waiting for execution.
So, a new pendingCommand structure is introduced to hold a parsed
command's arguments and its metadata.
- **New pendingCommandList structure (pending_cmds)** that contains all
the pending commands with maintained order and includes a ready_len
counter that tracks the number of fully parsed commands ready for
execution. All commands are fully parsed except possibly the last one
(client's command order is maintained).
- **New pendingCommandPool structure (cmd_pool)** that manages a shared
pool for reusing pendingCommand objects to reduce memory allocation
overhead.

There is a configurable lookahead limit (server.lookahead) that controls
how many fully parsed commands (ready pending commands) to process ahead
of time.

#### New High Level Flow for Standalone Commands (processInputBuffer())

- While there is data in the client's query buffer or there are ready
pending commands:
- While there is data in the client's query buffer and we haven't
reached the lookahead limit:
- Read the data and try to parse a complete command
(processInlineBuffer() or processMultibulkBuffer()). Allocate a new
pending command if needed, store the command's metadata in the pending
command, and add the pending command to the client's pending commands
list.
    - If the command is incomplete, exit and wait for more data.
- The command is complete, we have a new ready pending command,
preprocess it (preprocessCommand()):
- Extract the keys of the command and store the results in the pending
command (extractKeysAndSlot()).
- If there are pending commands, continue executing them until the queue
is empty.

## Transaction Support

### Major Changes in Structures

- The multiState structure now contains an array of pendingCommand
pointers instead of multiCmd pointers.
- The multiCmd structure was deleted (no longer needed).

### New Transaction Support

- queueMultiCommand():
- The pending commands are moved from the client's pending_cmds list to
the multiState's commands array.

## Detailed Changes

### Additional Client Structure Changes

- Replaced argv_len_sum with all_argv_len_sum to reflect the total
memory consumed by all pending commands.

### Clients and Pending Commands Management

- Clients using pending commands now manage the command arguments via
the pendingCommand. Specifically, the memory occupied by argv.
- **Pending commands management functions**:
- `initPendingCommand()` initializes a newly allocated pending command.
- `freeClientPendingCommand()` frees a pending command of a client and
its associated resources.
- `freeClientPendingCommands()` receives the number of pending commands
to free and calls freeClientPendingCommand() to free them.

### Buffer Processing Changes

- `processInlineBuffer()`, once a full command is read, used to populate
the client's command fields (argc, argv, etc.). Now it creates and
populates a pendingCommand, and adds it to the client's pending_cmds
list.
- `processMultibulkBuffer()`: Similar changes to processInlineBuffer().
The difference is that a pending command may already exist from a
previous call to the function, so parsing will continue populating it
instead of creating a new one.
- `resetClientInternal()` used to receive a free_argv parameter and pass
it to freeClientArgvInternal(), which freed the client's argv if set,
and also reset client's command fields. It now receives the number of
pending commands to free and handles two cases:
- The client uses pending commands so they are freed by calling
freeClientPendingCommands().
- The client doesn't use pending commands (e.g., LUA client) so the
client's argv is freed by calling freeClientArgvInternal().
It then frees the client's command fields that freeClientArgvInternal()
doesn't free now.

### Other Changes

- Simulate lookahead command preprocessing when loading an AOF and
queuing transaction commands; This is necessary since
queueMultiCommand() now requires a pending command.
- The INVALID_CLUSTER_SLOT constant was defined to indicate an invalid
cluster slot. It is used to signal a cross-slot error in
preprocessCommand().
- getNodeByQuery() no longer performs cross-slot checks, relying instead
on the checks already performed in preprocessCommand(). It also no
longer calls getKeysFromCommand() as this was also done in
preprocessCommand().

### Debugging

- Added "debug lookahead" command to print the size of the lookahead
pipeline for each client.

## New Configuration

- **lookahead**: Runtime-configurable lookahead depth (default: 16)

## Security

- **Limit lookahead for unauthenticated clients to 1**. This is both to
reduce memory overhead, and to prevent errors; AUTH can affect the
handling of succeeding commands.


---------

Co-authored-by: Slava Koyfman &lt;slava.koyfman@redis.com&gt;
Co-authored-by: Oran Agra &lt;oran@redis.com&gt;
Co-authored-by: Udi Ron &lt;udi.ron@redis.com&gt;
Co-authored-by: moticless &lt;moticless@github.com&gt;
Co-authored-by: Yuan Wang &lt;yuan.wang@redis.com&gt;</content>
</entry>
<entry>
<title>Ensure empty error tables in scripts don't crash (#14163)</title>
<updated>2025-07-07T02:12:51Z</updated>
<author>
<name>debing.sun</name>
<email>debing.sun@redis.com</email>
</author>
<published>2025-07-07T02:12:51Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=4322cebc1764d433b3fce3b3a108252648bf59e7'/>
<id>urn:sha1:4322cebc1764d433b3fce3b3a108252648bf59e7</id>
<content type='text'>
This PR is based on: https://github.com/valkey-io/valkey/pull/2229

When calling the command `EVAL error{} 0`, Redis crashes with the
following stack trace. This patch ensures we never leave the
`err_info.msg` field null when we fail to extract a proper error
message.

---------

Signed-off-by: Fusl &lt;fusl@meo.ws&gt;
Signed-off-by: Binbin &lt;binloveplay1314@qq.com&gt;
Co-authored-by: Fusl &lt;fusl@meo.ws&gt;
Co-authored-by: Binbin &lt;binloveplay1314@qq.com&gt;</content>
</entry>
<entry>
<title>Adding AGPLv3 as a license option to Redis! (#13997)</title>
<updated>2025-05-01T13:04:22Z</updated>
<author>
<name>Pieter Cailliau</name>
<email>pieter@redis.com</email>
</author>
<published>2025-05-01T13:04:22Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=d65102861f51af48241f607afa678c4c2a0f894c'/>
<id>urn:sha1:d65102861f51af48241f607afa678c4c2a0f894c</id>
<content type='text'>
Read more about [the new license option](http://redis.io/blog/agplv3/)
and [the Redis 8 release](http://redis.io/blog/redis-8-ga/).</content>
</entry>
<entry>
<title>Trigger Lua GC after script loading (#13407)</title>
<updated>2024-07-16T01:28:47Z</updated>
<author>
<name>debing.sun</name>
<email>debing.sun@redis.com</email>
</author>
<published>2024-07-16T01:28:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=88af96c7a2548013273d0be2bcb3690328e52a24'/>
<id>urn:sha1:88af96c7a2548013273d0be2bcb3690328e52a24</id>
<content type='text'>
Nowdays we do not trigger LUA GC after loading lua script. This means
that when a large number of scripts are loaded, such as when functions
are propagating from the master to the replica, if the LUA scripts are
never touched on the replica, the garbage might remain there
indefinitely.

Before this PR, we would share a gc_count between scripts and functions.
This means that, under certain circumstances, the GC trigger for scripts
and functions was not fair.
For example, loading a large number of scripts followed by a small
number of functions could result in the functions triggering GC.
In this PR, we assign a unique `gc_count` to each of them, so the GC
triggers between them will no longer affect each other.

on the other hand, this PR will to bring regession for script loading
commands(`FUNCTION LOAD` and `SCRIPT LOAD`), but they are not hot path,
we can ignore it, and it will be replaced
https://github.com/redis/redis/pull/13375 in the future.

---------

Co-authored-by: Oran Agra &lt;oran@redislabs.com&gt;</content>
</entry>
<entry>
<title>Change license from BSD-3 to dual RSALv2+SSPLv1 (#13157)</title>
<updated>2024-03-20T22:38:24Z</updated>
<author>
<name>Pieter Cailliau</name>
<email>pieter@redis.com</email>
</author>
<published>2024-03-20T22:38:24Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/redis.git/commit/?id=0b34396924eca4edc524469886dc5be6c77ec4ed'/>
<id>urn:sha1:0b34396924eca4edc524469886dc5be6c77ec4ed</id>
<content type='text'>
[Read more about the license change
here](https://redis.com/blog/redis-adopts-dual-source-available-licensing/)
Live long and prosper 🖖</content>
</entry>
</feed>
