apache/druid · warning

Exception pulling item from cache

Error message

Exception pulling item from cache

What it means

MemcachedCache.get waited on the async GET future and it completed exceptionally (ExecutionException). The cache increments errorCount, logs the warning, and returns null (cache miss) rather than propagating, so queries continue without cache but the underlying error (deserialization, connection failure, server error) is swallowed into metrics.

Solutions

  1. Read the logged ExecutionException cause for the actual memcached failure
  2. Verify memcached connectivity and that max item size fits cached values
  3. Confirm the same cache serialization format across the cluster (no version skew)
  4. Monitor errorCount; if persistent, fix connectivity or temporarily switch cache type

Example fix

null
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

null

Try / catch

// get() returns null on ExecutionException; always null-check and fall through to underlying data
var bytes = cache.get(new NamedKey(id, keyBytes)); if (bytes == null) { /* recompute */ }

Prevention

When it happens

Trigger: future.get(timeout) throws ExecutionException — the memcached server returned an error for the GET or the operation failed (connection closed, protocol error, value deserialization failure).

Common situations: Memcached server crashes or restarts mid-operation, oversized values exceeding server limits, network interruption, incompatible serialized bytes written by a different cache version.

Related errors


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

Appendix: source

Thrown at server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java:513

        if (bytes != null) {
          hitCount.incrementAndGet();
        } else {
          missCount.incrementAndGet();
        }
        return bytes == null ? null : deserializeValue(key, bytes);
      }
      catch (TimeoutException e) {
        timeoutCount.incrementAndGet();
        future.cancel(false);
        return null;
      }
      catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException(e);
      }
      catch (ExecutionException e) {
        errorCount.incrementAndGet();
        log.warn(e, "Exception pulling item from cache");
        return null;
      }
    }
  }

  @Override
  public void put(NamedKey key, byte[] value)
  {
    try (final ResourceHolder<MemcachedClientIF> clientHolder = client.get()) {
      clientHolder.get().set(
          computeKeyHash(memcachedPrefix, key),
          expiration,
          serializeValue(key, value)
      );
    }
    catch (IllegalStateException e) {
      // operation did not get queued in time (queue is full)
      errorCount.incrementAndGet();

View on GitHub (pinned to 9b90983fd2)