{"record":{"id":"08e9781a10095579","repo":"apache/druid","slug":"exception-pulling-item-from-cache","errorCode":null,"errorMessage":"Exception pulling item from cache","messagePattern":"Exception pulling item from cache","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java","lineNumber":513,"sourceCode":"        if (bytes != null) {\n          hitCount.incrementAndGet();\n        } else {\n          missCount.incrementAndGet();\n        }\n        return bytes == null ? null : deserializeValue(key, bytes);\n      }\n      catch (TimeoutException e) {\n        timeoutCount.incrementAndGet();\n        future.cancel(false);\n        return null;\n      }\n      catch (InterruptedException e) {\n        Thread.currentThread().interrupt();\n        throw new RuntimeException(e);\n      }\n      catch (ExecutionException e) {\n        errorCount.incrementAndGet();\n        log.warn(e, \"Exception pulling item from cache\");\n        return null;\n      }\n    }\n  }\n\n  @Override\n  public void put(NamedKey key, byte[] value)\n  {\n    try (final ResourceHolder<MemcachedClientIF> clientHolder = client.get()) {\n      clientHolder.get().set(\n          computeKeyHash(memcachedPrefix, key),\n          expiration,\n          serializeValue(key, value)\n      );\n    }\n    catch (IllegalStateException e) {\n      // operation did not get queued in time (queue is full)\n      errorCount.incrementAndGet();","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java#L495-L531","documentation":"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.","triggerScenarios":"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).","commonSituations":"Memcached server crashes or restarts mid-operation, oversized values exceeding server limits, network interruption, incompatible serialized bytes written by a different cache version.","solutions":["Read the logged ExecutionException cause for the actual memcached failure","Verify memcached connectivity and that max item size fits cached values","Confirm the same cache serialization format across the cluster (no version skew)","Monitor errorCount; if persistent, fix connectivity or temporarily switch cache type"],"exampleFix":"null","handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"// get() returns null on ExecutionException; always null-check and fall through to underlying data\nvar bytes = cache.get(new NamedKey(id, keyBytes)); if (bytes == null) { /* recompute */ }","preventionTips":["Monitor errorCount metric and alert on spikes","Ensure memcached max item size exceeds cached values","Prevent cache serialization format changes without version-aware keys"],"tags":["cache","memcached","network"],"backgroundTag":"cache-get-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}