{"record":{"id":"c4dd6648a547b8e3","repo":"apache/druid","slug":"unable-to-queue-cache-operation","errorCode":null,"errorMessage":"Unable to queue cache operation","messagePattern":"Unable to queue cache operation","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java","lineNumber":490,"sourceCode":"        0,\n        0,\n        timeoutCount.get(),\n        errorCount.get()\n    );\n  }\n\n  @Override\n  public byte[] get(NamedKey key)\n  {\n    try (ResourceHolder<MemcachedClientIF> clientHolder = client.get()) {\n      Future<Object> future;\n      try {\n        future = clientHolder.get().asyncGet(computeKeyHash(memcachedPrefix, key));\n      }\n      catch (IllegalStateException e) {\n        // operation did not get queued in time (queue is full)\n        errorCount.incrementAndGet();\n        log.warn(e, \"Unable to queue cache operation\");\n        return null;\n      }\n      try {\n        byte[] bytes = (byte[]) future.get(timeout, TimeUnit.MILLISECONDS);\n        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();","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java#L472-L508","documentation":"MemcachedCache.get failed to enqueue an async GET with the Memcached client because the client's operation queue was full (IllegalStateException from asyncGet). The cache treats this as a miss: it increments errorCount and returns null instead of throwing. This is a cache-capacity/pressure signal, not a data error.","triggerScenarios":"asyncGet throws IllegalStateException because the client's outbound queue is full — operations cannot be queued before the queue timeout, typically under very high cache read rates or a slow/unresponsive memcached server.","commonSituations":"Memcached server saturated or unreachable, timeoutSeconds for the cache too low, read QPS exceeding the client queue capacity, connection pool exhausted.","solutions":["Check memcached server health, memory, and network latency","Increase the cache timeout (timeoutSeconds) in the memcached cache config","Tune memcached client queue size / connection pool settings","Scale memcached or shard keys to reduce per-server load"],"exampleFix":"// before\ndruid.cache.type=memcached; druid.cache.timeout=100\n// after: give the client more time and capacity\ndruid.cache.timeout=60000; verify memcached host reachability and increase client queue size","handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"// Cache.get returns null on queue failure; treat null as a miss and fall back to the data source\nbyte[] val = cache.get(key); if (val == null) { /* fetch from segment storage */ }","preventionTips":["Monitor the errorCount metric on MemcachedCache","Right-size memcached (memory, connections) for read QPS","Increase timeoutSeconds; avoid overloading a single memcached server"],"tags":["cache","memcached","queue-full"],"backgroundTag":"cache-queue-full","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"}