diff options
author | Oran Agra <oran@redislabs.com> | 2021-06-22 07:35:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 07:35:59 +0300 |
commit | 9b564b525d8ce88295ec14ffdc3bede7e5f5c33e (patch) | |
tree | 66011ddee557117b42da90744c932f05678651ba /src/tracking.c | |
parent | f004073b54ee0b09afcb3789a8d835fd6018e99e (diff) | |
download | redis-9b564b525d8ce88295ec14ffdc3bede7e5f5c33e.tar.gz |
Fix race in client side tracking (#9116)
The `Tracking gets notification of expired keys` test in tracking.tcl
used to hung in valgrind CI quite a lot.
It turns out the reason is that with valgrind and a busy machine, the
server cron active expire cycle could easily run in the same event loop
as the command that created `mykey`, so that when they key got expired,
there were two change events to broadcast, one that set the key and one
that expired it, but since we used raxTryInsert, the client that was
associated with the "last" change was the one that created the key, so
the NOLOOP filtered that event.
This commit adds a test that reproduces the problem by using lazy expire
in a multi-exec which makes sure the key expires in the same event loop
as the one that added it.
Diffstat (limited to 'src/tracking.c')
-rw-r--r-- | src/tracking.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tracking.c b/src/tracking.c index f472309f6..d6f2bf149 100644 --- a/src/tracking.c +++ b/src/tracking.c @@ -326,7 +326,7 @@ void trackingRememberKeyToBroadcast(client *c, char *keyname, size_t keylen) { * tree. This way we know who was the client that did the last * change to the key, and can avoid sending the notification in the * case the client is in NOLOOP mode. */ - raxTryInsert(bs->keys,(unsigned char*)keyname,keylen,c,NULL); + raxInsert(bs->keys,(unsigned char*)keyname,keylen,c,NULL); } raxStop(&ri); } |