apache/druid · warning

Exception pulling item from cache

Error message

Exception pulling item from cache

What it means

AbstractRedisCache.get() catches JedisException when fetching a value from Redis and logs a warning instead of propagating it, returning null so callers treat it as a cache miss. The message is emitted for any Redis read failure; if the message contains 'Read timed out' the timeoutCount metric is incremented, otherwise errorCount is. This is deliberately non-fatal: a broken cache should degrade lookup performance, not fail queries.

Solutions

  1. Check Redis connectivity from the Druid host (redis-cli ping) and fix host/port/password config under druid.cache type=redis
  2. Increase the timeout setting in the redis cache config so slow reads do not time out
  3. Check Redis server logs for restarts, maxmemory eviction, or failover events
  4. Monitor timeoutCount/errorCount metrics; treat persistent nonzero errorCount as a config/connectivity problem
  5. Ensure the query can tolerate cache misses (cache is always best-effort)

Example fix

// before: cache config with too-tight timeout
{"type":"redis","timeout":"50"}
// after
{"type":"redis","timeout":"2000"}
Defensive patterns

Strategy: fallback

Validate before calling

// pre-check Redis reachability before relying on cached values
try (Jedis j = new Jedis(host, port, 2000)) { j.ping(); }

Try / catch

// get() already swallows failures; treat null as miss
byte[] val = cache.get(key);
if (val == null) { /* recompute from deep storage */ }

Prevention

When it happens

Trigger: Calling cache.get(key) when the Redis server is unreachable, connection is reset, or the socket read exceeds the configured timeout.

Common situations: Redis host/port misconfigured; Redis restarted or crashed; network latency or firewall dropping connections; Redis undersized so reads exceed the configured timeout; cluster failover in progress.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/7cacfcda70f7e9ae. Report an issue: GitHub.

Appendix: source

Thrown at extensions-contrib/redis-cache/src/main/java/org/apache/druid/client/cache/AbstractRedisCache.java:73

  {
    totalRequestCount.incrementAndGet();
    try {
      byte[] bytes = getFromRedis(key.toByteArray());
      if (bytes == null) {
        missCount.incrementAndGet();
        return null;
      } else {
        hitCount.incrementAndGet();
        return bytes;
      }
    }
    catch (JedisException e) {
      if (e.getMessage().contains("Read timed out")) {
        timeoutCount.incrementAndGet();
      } else {
        errorCount.incrementAndGet();
      }
      log.warn(e, "Exception pulling item from cache");
      return null;
    }
  }

  @Override
  public void put(NamedKey key, byte[] value)
  {
    totalRequestCount.incrementAndGet();
    try {
      this.putToRedis(key.toByteArray(), value, this.expiration);
    }
    catch (JedisException e) {
      errorCount.incrementAndGet();
      log.warn(e, "Exception pushing item to cache");
    }
  }

  @Override

View on GitHub (pinned to 9b90983fd2)