1. Redis version: 5.0.3
  2. desciotion:My redis's maxmemory_policy set allkeys-lru. But when memory used for max memory throw OOM exception. exception: org.springframework.dao.CannotAcquireLockException: Failed to lock mutex at LOCK:com.leixing.bbs.schedule.CheckOnlineAsynService.active:1541215; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: ERR Error running script (call to f_8426c8df41c64d8177dce3ecbbe9146ef3759cd2): @user_script:6: @user_script: 6: -OOM command not allowed when used memory > 'maxmemory'. ; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR Error running script (call to f_8426c8df41c64d8177dce3ecbbe9146ef3759cd2): @user_script:6: @user_script: 6: -OOM command not allowed when used memory > 'maxmemory'.
    at org.springframework.integration.redis.util.RedisLockRegistry$RedisLock.rethrowAsLockException(RedisLockRegistry.java:228) at org.springframework.integration.redis.util.RedisLockRegistry$RedisLock.lock(RedisLockRegistry.java:222) at com.leixing.common.concurrent.AutoLock.(AutoLock.java:15)
  3. My idea: I find exception all happened in use script commond. I guess it may be redis's eviction BUG。so what can i do handler it's problem?

Comment From: yossigo

@WilliamShoww That depends on your configuration, but even with allkeys-lru you may still get a -OOM if your memory usage is above maxmemory. As an extreme example, imagine maxmemory 1 on an empty instance.

Comment From: WilliamShoww

@WilliamShoww That depends on your configuration, but even with allkeys-lru you may still get a -OOM if your memory usage is above maxmemory. As an extreme example, imagine maxmemory 1 on an empty instance.

No maxmemory 1, my configuration maxmemory human is 9.31G。

Comment From: WilliamShoww

@WilliamShoww That depends on your configuration, but even with allkeys-lru you may still get a -OOM if your memory usage is above maxmemory. As an extreme example, imagine maxmemory 1 on an empty instance.

No maxmemory 1, my redis configuration maxmemory human is 9.31G, machine total memory is 64G,free 4G, cached is 15G,so memory is enough used.

Comment From: yossigo

@WilliamShoww That was just an example, there are other allocations that could result with Redis running out of memory without being able to evict - looking at info memory (when this happens) might provide the answer.

Comment From: sundb

Is there a timeout for lua scripts? If the lua script keeps timing out, it is possible to prevent evict from executing.