Repository navigation
[backport] Backport sweep for 8.0 - #5508
valkeyrie-ops[bot] wants to merge 36 commits into
Conversation
AI backport resolution: source PR #5417Abort dual-channel sync if the primary link breaks while streaming 2 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit 3e7dd8d60b20.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
AI backport resolution: source PR #4675Fix cluster bus self-forget use-after-free 2 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit 0abd28dc6ecc.
|
AI backport resolution: source PR #3245Fix assertion crash in processIOThreadsReadDone when DONT_PARSE client has stale argc 3 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit eed8daea7bbe.
|
AI backport resolution: source PR #5452Ignore replica claims that would close a replicaof cycle 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 7f7311a56ac4.
|
…5417) During dual-channel sync, once the replica's local buffer is full it stops reading the main channel. If the primary drops that channel, the replica doesn't notice. It replays the rest of its local buffer, which can be gigabytes, into a sync that is already dead, reports success, and sends `REPLCONF ACK` on a broken link. This change checks the primary connection in `streamReplDataBufToDb()` before each buffered block is applied, and after each `replStreamProgressCallback()` call while a compressed block is decoded, since that callback is the only I/O in the loop. If the connection is broken, the replica aborts the sync and reconnects. The buffered writes that haven't been applied yet are discarded rather than applied. This matches the existing abort when the main channel is lost while buffering (`readIntoReplDataBlock`): without the link the replica can't complete or acknowledge the sync, and it resyncs once it reconnects. --------- Signed-off-by: Shoham Elias <shohame@amazon.com> Signed-off-by: Shoham Elias <116083498+shohamazon@users.noreply.github.com> Co-authored-by: Amit Nagler <58042354+naglera@users.noreply.github.com> Backport-Source-PR: 5417 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
This PR fixes a use-after-free in the handling of `CLUSTERMSG_EXT_TYPE_FORGOTTEN_NODE` cluster-bus PING extensions. A cluster node can use this extension to tell its peers that another node has been forgotten. However, the receiver did not check whether the node named in the extension was also the sender of the message currently being processed. In that case, `clusterDelNode()` deleted the sender and freed its active cluster link and receive buffer. The extension handler then continued processing the same message and later accessed the now-freed sender and link. This could cause memory corruption and crash the server. ### How is it fixed? A node should not be able to legitimately announce that it has forgotten itself. The handler now treats this as an invalid cluster-bus message: - Logs a warning. - Closes the malformed connection. - Returns immediately without deleting the sender or continuing to process the packet. This preserves the existing behavior for valid forgotten-node extensions. Signed-off-by: Roshan Khatri <rvkhatri@amazon.com> Backport-Source-PR: 4675 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Fixes #5439 #5458 A node can crash on `debugServerAssert(primary->replicaof == NULL)` in `clusterNodeGetPrimary()`, reached through `updateShardId()` from `clusterProcessPacket()`. A node that resumes after a long pause handles a backlog of old gossip: 1. An old packet from R12 says it replicates R15, so the node sets `R12->replicaof = R15`. The node never learns that R12 became a primary. 2. A newer packet from R15 says it replicates R12. R15 was last seen as a replica, so this goes through the unguarded "Primary node changed for this replica?" block, which sets `R15->replicaof = R12`. 3. Now R12 and R15 replicate each other, and the next `updateShardId()` asserts. Skip a replica claim, and log it at NOTICE, when the claimed primary's `replicaof` chain already reaches the sender. The claimed primary's own packet then corrects the view. - No node is promoted on another node's word, which was the objection to assertion from #651 is unchanged. - The check walks the whole chain, so it also catches longer loops such as A → B → C → A. The walk stops after as many steps as there are nodes, so it ends even if the chain already contains a loop. New `tests/unit/cluster/replicaof-cycle.tcl` sends forged replica-claim PINGs, as in `failover-nack.tcl`, to create 2-node and 3-node loops on an observer node. This PR stops new replicaof cycles from forming at runtime. It does not handle a cycle that is already saved in `nodes.conf`. A release build without debug asserts can save one, because this same bug goes unchecked there. The risk if such a file is loaded: `clusterLoadConfig()` restores the links without checking them. With A ↔ B loaded, a claim from another node C naming A links C under the cycle. `clusterNodeGetPrimary(C)` then never returns, and the node hangs at 100% CPU. This behaves the same on `unstable`, so this PR does not make it worse. 1. **Should it be handled in this PR or in a follow-up?** 2. **Repair or reject at load?** - **Repair:** unlink one node in each cycle, never `myself`, log a WARNING and save the config. That node stays a replica with no known primary until its own packets correct the view. Nodes that saved a cycle on an older build keep starting. This matches how the loader already fixes a mismatched replica shard_id instead of aborting. - **Reject:** fail to start with "corrupted cluster config file". This is stricter, since the file alone can't tell which link is stale. The cost is that an affected node needs its `nodes.conf` fixed by hand before it can restart, including after an upgrade. Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com> Backport-Source-PR: 5452 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…t has stale argc (#3245) Found while reading the code — I have not yet been able to confirm whether this path can materialize in existing real-world scenarios. When an IO thread reads from a client with READ_FLAGS_DONT_PARSE set (because canParseCommand returns 0), processIOThreadsReadDone skips handleParseResults but still checks c->argc > 0 and sets pending_command = 1. However, argc may be stale from a previous incomplete pipelined command parse — it was set by consumeCommandQueue when handleParseResults returned PARSE_NEEDMORE, and was never cleared. This leads to processCommand being called with parsed_cmd == NULL and without READ_FLAGS_COMMAND_NOT_FOUND, triggering the assertion: ==> server.c:4177 'c->read_flags & READ_FLAGS_COMMAND_NOT_FOUND' is not true 1. IO thread parses pipelined commands; the last command is incomplete → cmd_queue entry has argc > 0, parsed_cmd = NULL 2. Main thread consumeCommandQueue pops the incomplete entry → c->argc > 0, c->parsed_cmd = NULL 3. handleParseResults returns PARSE_NEEDMORE → loop breaks, stale argc remains on the client 4. An external event makes canParseCommand return 0 for this client (e.g. close_after_reply, close_asap, or application-specific blocking flags) 5. New data arrives → trySendReadToIOThreads sets READ_FLAGS_DONT_PARSE 6. IO thread reads data, skips parsing 7. processIOThreadsReadDone: stale argc > 0 → pending_command = 1 8. processCommand: parsed_cmd == NULL, COMMAND_NOT_FOUND not set → assertion crash In processIOThreadsReadDone, when DONT_PARSE is set and argc > 0, skip the client. The argc is stale from a previous incomplete parse — the IO thread didn't parse anything new, so there is no valid command to execute. Added DEBUG SET-CLOSE-AFTER-REPLY <client-id> subcommand and a test that reproduces the crash deterministically: 1. Client sends a complete PING + incomplete SET (truncated value) in one pipeline 2. After PING reply confirms the incomplete parse was consumed (stale argc), DEBUG SET-CLOSE-AFTER-REPLY is called from another connection to simulate the external event 3. Client sends remaining data → triggers the DONT_PARSE path → crash on unfixed server --------- Signed-off-by: Arad Zilberstein <aradz@amazon.com> Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com> Backport-Source-PR: 3245 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…ue (#5476) In check mode, rdbLoadCheckModuleValue() walks a module value's opcodes until RDB_MODULE_OPCODE_EOF, but the opcode chain had no final branch. An RDB cut between two fields inside a module value made rdbLoadLen() return RDB_LENERR forever, so valkey-check-rdb, and server startup on a truncated RDB, hung at 100% CPU. Report a short read on RDB_LENERR and corruption on any other unknown opcode, and stop the loop. Backport-Source-PR: 5476 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
SWAPDB changes what clients read from both databases, but tracking clients get no invalidation and keep stale cached values. Send the same invalidation FLUSHDB does, to all tracking clients, since the tracking table doesn't store a key's database. --------- Signed-off-by: Kyuwon Jeong <jkw5033@gmail.com> Backport-Source-PR: 5690 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…5611) Fixes #5608. `lookupStringForBitCommand()` creates or zero-pads the string before the BITFIELD ops run, but `dirty` was only turned into `changes` inside the branch that actually writes. If every write fails with `OVERFLOW FAIL`, `changes` stays 0, so nothing is propagated and the key exists on the primary but not on the replica or in the AOF. This counts the creation/growth as one change in that case, the same way SETBIT treats `dirty`. The command is propagated as is, and the replica ends up with the same zero-padded string. Side effects: a fully rejected BITFIELD that creates or grows the key now behaves like SETBIT does. It fires the `setbit` keyspace event, invalidates WATCH and client tracking on the key, and bumps `dirty`. Tests in `tests/unit/bitfield.tcl`: the replication block covers a new key and a grown key, plus a WATCH test (EXEC used to return PONG there, now nil), and a new `appendonly yes` block checks the created key survives `DEBUG LOADAOF`. All three fail without the bitops.c change and pass with it: ``` ./runtest --single unit/bitfield ``` `unit/bitops` and `unit/pubsub` also pass. --------- Signed-off-by: xhon-pelushi <xhon@pelushi.com> Backport-Source-PR: 5611 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
ffcc415 to
979c514
Compare
### Description User data logged when crash caused by moduleRDBLoadError. ### Change Redact user data when hide-user-data-from-log enabled. Signed-off-by: VanessaTang <yuetan@amazon.com> Backport-Source-PR: 2274 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
When using XREAD STREAMS <stream> + on an empty stream created with MKSTREAM, valkey returns an error instead of nil. This happens because is missing a check on the stream length. The fix adds the length check on the condition. Fixes #2728 Signed-off-by: diego-ciciani01 <diego.ciciani@gmail.com> Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Backport-Source-PR: 2742 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
AI backport resolution: source PR #2742Fix XREAD returning error on empty stream with + ID 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 03e0792fceea.
|
Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…onfigured (#2846) When dual-channel-replication is enabled, and replica-announce-ip is set, the RDB/AOF channel does not announce itself at this endpoint. This defaults to the IP address behind the NAT, or the Kubernetes Pod IP in our case. This means that if Sentinel is polling the primary for connected replicas, it will first see the ephemeral pod IP, then revert to the announce-ip - leaving behind the pod IP as a down replica. This PR configures the RDB/AOF channel to also announce itself at the announce-ip to prevent the stale replica. I evaluated writing unit tests for this, but I am not sure of a way we can test an IP address different to localhost (127.0.0.1) that would fail without the fix. I did test on Kubernetes against 9.0 tag and verified the fix there too. On 9.0 image tag: ``` $ kubectl get pods -n valkey-baseline -o custom-columns=NAME:.metadata.name,POD-IP:.status.podIP NAME POD-IP valkey-primary-5bd78c8566-llb6k 10.244.0.25 valkey-replica-0 10.244.0.17 valkey-replica-1 10.244.0.13 $ kubectl get services -n valkey-baseline -o custom-columns=NAME:.metadata.name,CLUSTER-IP:.spec.clusterIP NAME CLUSTER-IP valkey-primary 10.96.147.28 valkey-replica-0 10.96.66.233 valkey-replica-1 10.96.57.230 ``` Logs below show that pod IP for valkey-primary-5bd78c8566-llb6k `10.244.0.25:6379` is being used for dual-channel replication. This should be its cluster IP `10.96.147.28` as this is what is set in replica-announce-ip. ``` 1:M 14 Nov 2025 17:57:51.750 * Replica 10.96.147.28:6379 asks for synchronization 1:M 14 Nov 2025 17:57:51.751 * Replica 10.244.0.25:6379 asks for synchronization 1:M 14 Nov 2025 17:57:56.135 * Dual channel replication: Sending to replica 10.244.0.25:6379 RDB end offset 1763269 and client-id 35 1:M 14 Nov 2025 17:57:56.140 * Replica 10.96.147.28:6379 asks for synchronization ``` ``` $ kubectl get pods -n valkey-test -o custom-columns=NAME:.metadata.name,CLUSTER-IP:.status.podIP NAME POD-IP valkey-primary-594c9597b5-qqvdk 10.244.0.26 valkey-replica-0 10.244.0.10 valkey-replica-1 10.244.0.18 $ kubectl get services -n valkey-test -o custom-columns=NAME:.metadata.name,CLUSTER-IP:.spec.clusterIP NAME CLUSTER-IP valkey-primary 10.96.125.142 valkey-replica None valkey-replica-0 10.96.155.74 valkey-replica-1 10.96.64.111 valkey-sentinel None ``` Logs show that the Cluster IP is now being used for dual-channel replication. ``` 1:M 14 Nov 2025 17:57:49.923 * Replica 10.96.125.142:6379 asks for synchronization 1:M 14 Nov 2025 17:57:49.924 * Replica 10.96.125.142:6379 asks for synchronization 1:M 14 Nov 2025 17:57:54.913 * Dual channel replication: Sending to replica 10.96.125.142:6379 RDB end offset 1771247 and client-id 36 1:M 14 Nov 2025 17:57:54.916 * Replica 10.96.125.142:6379 asks for synchronization ``` Fixes #2338 Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com> Backport-Source-PR: 2846 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…igs (#3440) rewriteConfigFormatMemory() and rewriteConfigBytesOption() used long long parameters to represent memory bytes, but configs like maxmemory are stored as unsigned long long and allow values up to ULLONG_MAX. When the value exceeds LLONG_MAX (e.g. 9223372036854775808), it overflows to negative when passed as long long, causing config rewrite to produce incorrect output like "maxmemory -8589934592gb". Change both functions to use unsigned long long, matching the actual semantics of memory byte values. This is consistent with how numericConfigGet() already handles MEMORY_CONFIG using ull2string(). There are some MEMORY_CONFIG are signed and can be negative: 1. maxmemory-clients is a PERCENT_CONFIG 2. slot-migration-max-failover-repl-bytes is a SIGNED_MEMORY_CONFIG (after #3443) None of them were affected: ``` static void numericConfigRewrite(standardConfig *config, const char *name, struct rewriteConfigState *state) { ... if (config->data.numeric.flags & PERCENT_CONFIG && value < 0) { rewriteConfigPercentOption(state, name, -value, config->data.numeric.default_value); } else if (config->data.numeric.flags & SIGNED_MEMORY_CONFIG && value < 0) { rewriteConfigNumericalOption(state, name, value, config->data.numeric.default_value); } else if (config->data.numeric.flags & MEMORY_CONFIG) { rewriteConfigBytesOption(state, name, value, config->data.numeric.default_value); ... ``` Signed-off-by: Binbin <binloveplay1314@qq.com> Backport-Source-PR: 3440 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…3583) Backport-Source-PR: 3583 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Fixes server crash when RDMA benchmark clients disconnect (part of
This PR focuses on the server-side crash fix. The benchmark
client-side fix will be submitted in a separate PR.
When interrupting valkey-benchmark with Ctrl+C, the server would crash
with a segmentation fault in handleReadResult, accessing address 0x8
(NULL pointer dereference).
The same RDMA connection could be added to pending_list multiple times,
leading to use-after-free:
1. When a client disconnects, rdmaHandleDisconnect() adds the connection
to pending_list and sets conn->state = CONN_STATE_CLOSED
2. Before rdmaProcessPendingData() processes it, event-driven callbacks
(e.g., connRdmaSetWriteHandler) could add the same connection again to
pending_list
3. In rdmaProcessPendingData(), the first iteration processes and may
free the connection, but the second iteration accesses the already freed
connection → SIGSEGV at address 0x8 (NULL + offset)
The problem was exacerbated because:
- valkey-benchmark creates multiple concurrent connections
- On Ctrl+C, these connections disconnect nearly simultaneously
- Event callbacks can re-add connections before processing completes
**Stack trace from crash:**
handleReadResult+0x100
readQueryFromClient+0x63
rdmaProcessPendingData (0x1b1eb9)
beforeSleep+0x82
Four targeted fixes in `src/rdma.c`:
1. `rdmaHandleDisconnect (line 535)`: Check if pending_list_node is NULL
before adding to pending_list to prevent duplicates
```C
/* we can't close connection now, let's mark this connection as closed
state */
if (rdma_conn->pending_list_node == NULL) {
listAddNodeTail(pending_list, conn);
rdma_conn->pending_list_node = listLast(pending_list);
}
```
2. `connRdmaSetWriteHandler (line 956)`: Add same check before adding to
pending_list to prevent duplicates during write handler updates
```C
/* does this connection has pending write data? */
if (func) {
if (rdma_conn->pending_list_node == NULL) {
listAddNodeTail(pending_list, conn);
rdma_conn->pending_list_node = listLast(pending_list);
}
} else if (rdma_conn->pending_list_node) {
listDelNode(pending_list, rdma_conn->pending_list_node);
rdma_conn->pending_list_node = NULL;
}
```
3. `rdmaProcessPendingData (line 1786)`: Use iterator node 'ln' instead
of rdma_conn->pending_list_node when deleting, as the latter may have
been overwritten if the connection was re-added
```C
listDelNode(pending_list, ln); // Use ln, not
rdma_conn->pending_list_node
rdma_conn->pending_list_node = NULL;
```
4. `rdmaProcessPendingData (line 1782-1787)`: Reorder operations to call
handlers before deleting from list, ensuring connection structure
remains valid during handler execution
```C
if (conn->state == CONN_STATE_ERROR || conn->state == CONN_STATE_CLOSED)
{
/* Invoke handlers first, then remove from list */
if (callHandler(conn, conn->read_handler)) {
callHandler(conn, conn->write_handler);
}
listDelNode(pending_list, ln);
rdma_conn->pending_list_node = NULL;
++processed;
continue;
}
```
The fix uses **pending_list_node** as both a list pointer and a
"**already in list**" flag:
- NULL = not in list, safe to add
- non-NULL = already in list, skip adding
This ensures each connection appears in pending_list at most once,
preventing use-after-free crashes.
Signed-off-by: Ada-Church-Closure <nunotabashinobu066@gmail.com>
Backport-Source-PR: 3448
Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
AI backport resolution: source PR #4140Retry PSYNC on -BUSY error instead of downgrading to SYNC 4 AI-edited files Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 8b65e4f58874.
|
AI backport resolution: source PR #4380Resolve a key's slot from the key, not from the executing command 5 AI-edited files Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 665700c9c133.
|
AI backport resolution: source PR #4877Block DEBUG RELOAD and DEBUG LOADAOF in loading and async-loading 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 68fd7542c72a.
|
AI backport resolution: source PR #5141Don't block CLUSTER SETSLOT on replica acks when the client cannot block 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 5ac6672607bd.
|
CONFIG REWRITE writes the REPLICAOF host into the config file unquoted, and REPLICAOF accepts any host string. A host containing a newline turns into several lines in the file, so on the next start the server replicates from a truncated host and loads whatever followed the newline as config directives, including file-only settings like `enable-module-command`. The fix writes the host through `sdscatrepr()`, as every other string option already does, so it reads back as one argument. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com> Backport-Source-PR: 5176 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
`MurmurHash64A()` takes the element length as an `int`, but PFADD passes a `size_t`. For an element of 2^31 bytes or more, the length goes negative and the end pointer lands before the start of the element. The hash loop then reads past the element until the server segfaults. Taking the length as `size_t` fixes this. The hash is unchanged for every element shorter than 2^31 bytes, so existing HyperLogLogs keep their meaning. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com> Backport-Source-PR: 5132 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
While a forked `SCRIPT DEBUG` session is open, `serverCron()` never evaluates the `save` points or the automatic AOF rewrite, so a client that opens a debug session and goes idle stops automatic RDB snapshots and AOF compaction until it disconnects. The save-point checks sit in the `else` of the branch that reaps finished children, and that branch also fires whenever a debugging child is pending. This change still reaps debugging children, but no longer lets them on their own postpone the save points. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com> Backport-Source-PR: 5153 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…5379) Skip crash memory test under valgrind Signed-off-by: Jim Brunner <brunnerj@amazon.com> Backport-Source-PR: 5379 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Fixes #5515 #5516 `Replica aborts streaming when the primary link breaks mid-stream` (both `repl-compression no` and `lz4`) fails in daily valgrind job The test holds the replica's RDB load with `key-load-delay 10000`, which is a fixed ~200 s of wall-clock time. During the hold, the primary buffers 4000 `SUNIONSTORE`s of a 10k-member set. Under valgrind those unions took 24-40 min, so: - the load ended on its own first, and the test failed at `assert_equal 1 [s 0 loading]`, or - the flood alone ran past the 2400 s test timeout (lz4), which ends the whole valgrind job. With lz4 there is a second problem. The replica checks the link once per 1 MB decoded (`REPL_DECODE_EVENT_BUDGET`). With a 4 KB key name, each round holds ~250 slow unions, so under valgrind the abort is logged after the 10 s wait has expired. Scale the flood (set size, command count, and key-name length) to the build the test runs on, valgrind or native, so it stays short on both. The assertions are unchanged. | | Native | Valgrind | |---|---|---| | Before | 11-14 s | fails (24-40 min flood on CI) | | After | ~12.5 s | ~25 s | Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com> Backport-Source-PR: 5526 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Followup for #5452 An older version could save a replicaof cycle (A -> B -> A) to nodes.conf from stale gossip. A later replica claim naming a node in the cycle as its primary then makes clusterNodeGetPrimary() loop forever. The file alone can't tell which link is stale, so fail to start with a corrupted config error. Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com> Backport-Source-PR: 5556 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Clamp used_memory_dataset (used_memory - used_memory_overhead) at 0 instead of letting the size_t subtraction wrap when the overhead is larger. Backport-Source-PR: 5644 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…2933) The node ids returned by `ValkeyModule_GetClusterNodesList` are not null terminated, but fixed-length buffers. When these are passed to `ValkeyModule_GetClusterNodeInfo`, which until now required the node id to be null terminated, the node lookup failed or potentially caused undefined behavior when `strlen` read outside of allocated memory. This error can be seen in the example module hellocluster.c included in this repo. This commit changes `ValkeyModule_GetClusterNodeInfo` and `ValkeyModule_GetClusterNodeInfoForClient` to assumes the node id to be exactly 40 bytes long and does not require it to be null terminated. It's not a breaking change, since passing a valid null-terminated node id still works as expected. --------- Signed-off-by: Deepak Nandihalli <deepakrn@users.noreply.github.com> Signed-off-by: Deepak Nandihalli <deepak.nandihalli@gmail.com> Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech> Backport-Source-PR: 2933 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
…OFF (#5682) On $ENDOFF, dualChannelReplHandleEndOffsetResponse() starts the PSYNC handshake on the main link with dualChannelSetupMainConnForPsync(). If a write on the main link fails there, that function calls cancelReplicationHandshake(), which aborts the whole dual channel sync: the RDB channel is closed, repl_rdb_transfer_s is NULL and repl_rdb_channel_state is NONE. The caller then set a read handler on the NULL repl_rdb_transfer_s and the replica crashed with SIGSEGV. Return C_RETRY when the RDB channel state is NONE after the main channel setup. C_ERR cannot be used: the error path would abort the sync a second time and replicationAbortDualChannelSyncTransfer() asserts that a sync is in progress. Add an integration test with a fake primary that resets the main link after +DUALCHANNELSYNC and then sends a valid $ENDOFF on the RDB channel. --------- Signed-off-by: Eran Liberty <eran.liberty@gmail.com> Co-authored-by: valkey-review-bot[bot] <282604435+valkey-review-bot[bot]@users.noreply.github.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com> Backport-Source-PR: 5682 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Sanitize CR/LF in FUNCTION LIST's error reply for an invalid argument, so it can't break the RESP stream. Backport-Source-PR: 5369 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Fixes #4935 - AOF rewrite and `CLUSTER MIGRATESLOTS` rebuild consumer-group PELs as `XCLAIM FORCE JUSTID`. That command skipped IDs whose stream entry was already `XDEL`'d / trimmed, so pending ownership and delivery counts diverged from the source. - Keep the live XCLAIM cleanup (`nack != NULL` still drops a dangling PEL entry). Only an obeyed `FORCE JUSTID` with an empty PEL (AOF client, slot import, replica) may recreate the NACK. Signed-off-by: quanyeyang <quanyemostima@gmail.com> Backport-Source-PR: 4973 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
AI backport resolution: source PR #4973Fix AOF/slot-migration dropping deleted stream PEL entries 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 835db3b101d4.
|
AI backport resolution: source PR #5132Hash HyperLogLog elements with a size_t length 2 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit d0cd3702548f.
|
AI backport resolution: source PR #5153Do not let forked script debug sessions postpone automatic saves 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit e1a97244570d.
|
AI backport resolution: source PR #5176Quote the replicaof host when rewriting the config file 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit b9be94f7a953.
|
AI backport resolution: source PR #5369Sanitize FUNCTION LIST error replies 2 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit 07b8194bd6d9.
|
AI backport resolution: source PR #5526Fix flaky dual-channel mid-stream abort test under valgrind 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit f7f3a403f1ac.
|
AI backport resolution: source PR #5556Refuse to load a replicaof cycle from nodes.conf 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 7adf80ab3db2.
|
AI backport resolution: source PR #5644Prevent size_t underflow in used_memory_dataset calculation 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 6db603245e3c.
|
AI backport resolution: source PR #5682Abort dual channel sync cleanly when main link write fails after $ENDOFF 2 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit d51cf6c8aa1e.
|
killAppendOnlyChild() waits with waitpid(-1, ...), which reaps any child that has exited, not just the AOF rewrite child, and drops its status. If a forked SCRIPT DEBUG session has ended but serverCron hasn't reaped it yet, stopping AOF during a rewrite reaps it there. Its pid then stays in the debugger children list, so serverCron logs "waitpid() returned an error" on every tick, and on shutdown the stale pid, which may belong to an unrelated process by then, gets a SIGKILL. This patch waits for server.child_pid only, like TerminateModuleForkChild() already does. serverCron doesn't reap children while a script is running, so the new test ends the debug session while the server is in a busy script, and starts and kills the rewrite right after the script. Once the debug session child is reaped, it checks that the server doesn't try to kill it on shutdown. This affects all versions. Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com> Backport-Source-PR: 5529 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
AI backport resolution: source PR #5529Fix killAppendOnlyChild reaping children other than the AOF rewrite child 1 AI-edited file Claude Summary
AI-edited files requiring review
Full backport commit diff: commit 4433a5bf426e.
|
…5558) Followup for #5526 (Was missed when handling the valgrind failures) Fixes #5553 After the mid-stream abort, the replica partially resyncs and has to apply ~2500 buffered SUNIONSTORE commands. On slower CI runners (~3-4 ms per command) that takes 7-10 s, which overruns the fixed 5 s budget in wait_for_ofs_sync. `wait_for_ofs_sync` now takes optional maxtries/delay arguments (defaults unchanged), and this test uses 30s (3x largest observed delay). The failure message also prints both offsets, so a real stall can be told apart from a slow apply. Signed-off-by: Bara' Hasheesh <bara.hasheesh@gmail.com> Co-authored-by: Ran Shidlansik <ranshid@amazon.com> Backport-Source-PR: 5558 Signed-off-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
AI backport resolution: source PR #5558Extend offset-sync wait after mid-stream abort in dual-channel test 2 AI-edited files Claude Summary
AI-edited files requiring review Full backport commit diff: commit 058efdf3b407.
|
Backport sweep for 8.0
Automated cherry-picks from PRs marked "To be backported".
CI fixes for this sweep are in #5699.
Applied
AI resolution details are posted as comments on this PR when available.
Needs attention
These candidates could not be applied automatically and need a maintainer to follow up.
5 candidate(s)
Generated by valkey-ci-agent using Claude Code.