Fix AOF loading crash after VADD with CAS by lazerg · Pull Request #16015 · redis/redis · GitHub
Skip to content

Fix AOF loading crash after VADD with CAS - #16015

Open
lazerg wants to merge 1 commit into
redis:unstablefrom
lazerg:fix-vadd-cas-aof-deny-blocking
Open

lazerg wants to merge 1 commit into
redis:unstablefrom
lazerg:fix-vadd-cas-aof-deny-blocking

Conversation

@lazerg

@lazerg lazerg commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #16014

VADD ... CAS on an existing set blocks the client and is replicated verbatim, so CAS ends up in the AOF. On replay the AOF client has CLIENT_DENY_BLOCKING, but VADD only drops CAS for replicated, Lua and MULTI contexts, so the replayed command blocks the AOF client and loadSingleAppendOnlyFile() asserts. After that every restart aborts at the same spot.

This adds REDISMODULE_CTX_FLAGS_DENY_BLOCKING to that mask so CAS is ignored whenever the client can't block, and the insert runs synchronously. AOF files already written with CAS load fine with the change. The new test writes two VADD ... CAS to the AOF and runs DEBUG LOADAOF; it crashes the server without the fix.


Note

Medium Risk
Targets persistence replay and blocking semantics for VADD CAS; change is narrow but affects startup when AOF contains CAS commands.

Overview
Fixes AOF startup crash when the log contains VADD ... CAS on an existing vector set: replay used the threaded CAS path and tried to block the AOF client, which is not allowed.

VADD now treats REDISMODULE_CTX_FLAGS_DENY_BLOCKING like replica/Lua/MULTI and clears CAS, so inserts run synchronously during AOF load (and for any other non-blocking client). Existing AOF files that already recorded CAS should replay without changing semantics beyond avoiding the block.

Adds regression test vadd_cas_aof.py: enable AOF, issue two VADD ... CAS, run DEBUG LOADAOF, and assert the server stays up with VCARD == 2.

Reviewed by Cursor Bugbot for commit 6bd5a0e. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant