summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMadelyn Olson <34459052+madolson@users.noreply.github.com>2023-02-21 08:14:41 -0800
committerGitHub <noreply@github.com>2023-02-21 08:14:41 -0800
commitdca5927ac868ad697f646bcf9efc6d9b79afb03f (patch)
tree6adfa7021f325cfa853e05513f38a13ef4ac9e77 /src
parent4cc2b0dc1a7d198cddfcc04f77ecd15126b86e3f (diff)
downloadredis-dca5927ac868ad697f646bcf9efc6d9b79afb03f.tar.gz
Prevent Redis from crashing from key tracking invalidations (#11814)
There is a built in limit to client side tracking keys, which when exceeded will invalidate keys. This occurs in two places, one in the server cron and other before executing a command. If it happens in the second scenario, the invalidations will be queued for later since current client is set. This queue is never drained if a command is not executed (through call) such as a multi-exec command getting queued. This results in a later server assert crashing.
Diffstat (limited to 'src')
-rw-r--r--src/tracking.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tracking.c b/src/tracking.c
index 3d207563f..775eea684 100644
--- a/src/tracking.c
+++ b/src/tracking.c
@@ -393,10 +393,10 @@ void trackingInvalidateKey(client *c, robj *keyobj, int bcast) {
continue;
}
- /* If target is current client, we need schedule key invalidation.
+ /* If target is current client and it's executing a command, we need schedule key invalidation.
* As the invalidation messages may be interleaved with command
- * response and should after command response */
- if (target == server.current_client){
+ * response and should after command response. */
+ if (target == server.current_client && (server.current_client->flags & CLIENT_EXECUTING_COMMAND)) {
incrRefCount(keyobj);
listAddNodeTail(server.tracking_pending_keys, keyobj);
} else {