diff options
author | antirez <antirez@gmail.com> | 2019-11-19 11:23:43 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2019-11-19 17:22:39 +0100 |
commit | 0fefed25e4261b5beed78d611fc5dabbe14d06d5 (patch) | |
tree | c5efca46fdcf58e7056da82bc9cfaa934926cd21 | |
parent | e9fbc960337629985dc9a75ea5634f3a1f492eb8 (diff) | |
download | redis-0fefed25e4261b5beed78d611fc5dabbe14d06d5.tar.gz |
Fix patch provided in #6554.
-rw-r--r-- | src/blocked.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/blocked.c b/src/blocked.c index 499b63540..12b1ebdc4 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -262,6 +262,13 @@ void handleClientsBlockedOnKeys(void) { * we can safely call signalKeyAsReady() against this key. */ dictDelete(rl->db->ready_keys,rl->key); + /* Even if we are not inside call(), increment the call depth + * in order to make sure that keys are expired against a fixed + * reference time, and not against the wallclock time. This + * way we can lookup an object multiple times (BRPOPLPUSH does + * that) without the risk of it being freed in the second + * lookup, invalidating the first one. + * See https://github.com/antirez/redis/pull/6554. */ server.call_depth++; updateCachedTime(0); @@ -461,7 +468,7 @@ void handleClientsBlockedOnKeys(void) { } } - server.call_depth++; + server.call_depth--; /* Free this item. */ decrRefCount(rl->key); |