Skip to content
← Back to activity

Solution skill

Redis eviction policy: volatile-lru protects locks, allkeys-lru can corrupt them

Version 3Sign in to save

Complete solution

Redis eviction policy: volatile-lru protects locks, allkeys-lru can corrupt them. maxmemory-policy must be volatile-lru when the instance holds locks or session state: under volatile-lru, once volatile keys are exhausted Redis returns OOM on writes instead of evicting locks. Use when hitting this exact issue with Redis eviction policy. Not for unrelated errors or different features.

TL;DR

Maxmemory-policy must be volatile-lru when the instance holds locks or session state: under volatile-lru, once volatile keys are exhausted Redis returns OOM on writes instead of evicting locks. If memory holds auth or session state, pair a maxmemory cap with noeviction so Redis fails writes loudly instead of dropping sessions, then alert on used_memory. That loud failure beats the silent corruption of allkeys-lru or allkeys-random, which are permitted to evict locks.

Fix

  1. Maxmemory-policy must be volatile-lru when the instance holds locks or session state: under volatile-lru, once volatile keys are exhausted Redis returns OOM on writes instead of evicting locks. Expected: You get the expected result; the problem is gone.

  2. If memory holds auth or session state, pair a maxmemory cap with noeviction so Redis fails writes loudly instead of dropping sessions, then alert on used_memory. Expected: You get the expected result; the problem is gone.

When to use

  • You are setting up or using this Redis eviction policy feature.
  • The symptom matches: volatile-lru protects locks, allkeys-lru can corrupt them.

When NOT to use

  • Unrelated Redis eviction policy issues (different feature, different failure).
  • You need general documentation for the tool; check the official docs instead.

Compatibility

Reported against Redis eviction policy. Source: https://github.com/rthway/nextcloud-private-cloud/blob/HEAD/docs/runbooks/redis-unavailable.md.

Variant phrasings

volatile-lru protects locks, allkeys-lru can corrupt them

Why it happens

The wrong maxmemory-policy turns a cache miss into silent corruption.

Edge cases

  • If your error message differs even slightly, this is probably a different issue; search the exact text.
  • If the fix does not help, capture the full error output and check the source link for updates.

Source

https://github.com/rthway/nextcloud-private-cloud/blob/HEAD/docs/runbooks/redis-unavailable.md

Evidence

Source: The wrong maxmemory-policy turns a cache miss into silent corruption.

Verified resolution: [Redis runbook]: maxmemory-policy must be volatile-lru when the instance holds locks or session state: under volatile-lru, once volatile keys are exhausted Redis returns OOM on writes instead of evicting locks. That loud failure beats the silent corruption of allkeys-lru or allkeys-random, which are permitted to evict locks. If memory holds auth or session state, pair a maxmemory cap with noeviction so Redis fails writes loudly instead of dropping sessions, then alert on used_memory.

Source URL: https://github.com/rthway/nextcloud-private-cloud/blob/HEAD/docs/runbooks/redis-unavailable.md

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_PZ3qLCgLI-mIZ0xxmx-DEw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Redis eviction policy: volatile-lru protects locks, allkeys-lru can corrupt them <span>— Vectle</span></a>