apache/druid · warning

Exception pulling items from cache

Error message

Exception pulling items from cache

What it means

AbstractRedisCache.getBulk() catches JedisException when fetching multiple values (MGET/pipeline) from Redis and returns an empty map, logging this warning. A message containing 'Read timed out' increments timeoutCount; anything else increments errorCount. Like get(), failures degrade to a cache miss rather than failing the operation.

Solutions

  1. Verify Redis reachability and increase the read timeout in the redis cache config
  2. Reduce bulk sizes or Redis network latency (same-DC deployment)
  3. Check Redis server health (latency, maxmemory, slowlog)
  4. Watch errorCount vs timeoutCount metrics to distinguish connectivity errors from slow reads
  5. Accept empty results gracefully: getBulk always returns an empty map on failure by design

Example fix

// before
Map<NamedKey, byte[]> values = cache.getBulk(keys); // assume all present
// after: handle partial/empty results
Map<NamedKey, byte[]> values = cache.getBulk(keys);
List<NamedKey> missing = keys.stream().filter(k -> !values.containsKey(k)).collect(Collectors.toList());
Defensive patterns

Strategy: fallback

Validate before calling

try (Jedis j = new Jedis(host, port, 2000)) { j.ping(); }

Try / catch

Map<NamedKey, byte[]> vals = cache.getBulk(keys);
// always check per-key presence; empty map is returned on any Redis failure
List<NamedKey> missing = keys.stream().filter(k -> !vals.containsKey(k)).collect(Collectors.toList());

Prevention

When it happens

Trigger: Calling cache.getBulk(keys) when the Redis connection fails or a pipelined/multi-key read times out.

Common situations: Bulk fetch of many segment keys over a slow network to Redis; Redis load shedding during heavy load; connection pool exhausted; Redis cluster resharding mid-read.

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/1cd3f4cf05d966e9. Report an issue: GitHub.

Appendix: source

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

  @Override
  public Map<NamedKey, byte[]> getBulk(Iterable<NamedKey> keys)
  {
    totalRequestCount.incrementAndGet();
    try {
      Pair<Integer, Map<NamedKey, byte[]>> results = this.mgetFromRedis(keys);

      hitCount.addAndGet(results.rhs.size());
      missCount.addAndGet(results.lhs - results.rhs.size());
      return results.rhs;
    }
    catch (JedisException e) {
      if (e.getMessage().contains("Read timed out")) {
        timeoutCount.incrementAndGet();
      } else {
        errorCount.incrementAndGet();
      }
      log.warn(e, "Exception pulling items from cache");
      return Collections.emptyMap();
    }
  }

  @Override
  public void close(String namespace)
  {
    // no resources to cleanup
  }

  @Override
  @LifecycleStop
  public void close()
  {
    cleanup();
  }

  @Override

View on GitHub (pinned to 9b90983fd2)