Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

volatile-lru maxmemory policy segfault fixed, thanks to Anthony Lauzo…

…n for reporting the problem with the patch. Original patch modified a bit in order to avoid the double lookup if the policy is allkeys-lru
  • Loading branch information...
commit 0c2f75c6d809a1658a244e74ef209dabb19fb4c7 1 parent 11fd0c4
@antirez authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/redis.c
4 src/redis.c
@@ -1372,6 +1372,10 @@ void freeMemoryIfNeeded(void) {
de = dictGetRandomKey(dict);
thiskey = dictGetEntryKey(de);
+ /* When policy is volatile-lru we need an additonal lookup
+ * to locate the real key, as dict is set to db->expires. */
+ if (server.maxmemory_policy == REDIS_MAXMEMORY_VOLATILE_LRU)
+ de = dictFind(db->dict, thiskey);
o = dictGetEntryVal(de);
thisval = estimateObjectIdleTime(o);
Please sign in to comment.
Something went wrong with that request. Please try again.