apache/druid · warning

Could not populate cache

Error message

Could not populate cache

What it means

BackgroundCachePopulator serializes query results and writes them into the cache on a background thread. Any exception during cache.put (serialization size issues, cache failures, interruption) is caught, logged as 'Could not populate cache', and counted in cachePopulatorStats as an error. Caching is best-effort; the query result is unaffected.

Solutions

  1. Check cache backend health (memcached connectivity, memory) and fix the underlying put failure using the logged exception stack trace.
  2. Lower cache entry size limits or enable result chunking if large results exceed cache limits.
  3. Confirm the cache configuration (type, hosts, timeouts) in the query cache settings is correct.
  4. Accept as benign if frequent only under overload — stats are surfaced via cachePopulator metrics for monitoring.
Defensive patterns

Strategy: try-catch

Validate before calling

// verify cache backend reachability before enabling population
// e.g. check memcached host connectivity at startup

Try / catch

try { cache.put(key, bytes); } catch (Exception e) { log.warn(e, "Could not populate cache"); stats.incrementError(); }

Prevention

When it happens

Trigger: The background thread calls populateCache and cache.put throws — e.g. cache backend failure (memcached connection lost), value exceeds cache limits, or serialization of the result bytes fails.

Common situations: Memcached or caffeine backend unavailable/evicting aggressively; oversized result sets exceeding cache entry limits; cache node restarted during heavy load; disk/heap pressure on cache host.

Related errors


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

Appendix: source

Thrown at server/src/main/java/org/apache/druid/client/cache/BackgroundCachePopulator.java:147

          JacksonUtils.writeObjectUsingSerializerProvider(gen, serializers, result);

          if (maxEntrySize > 0 && bytes.size() > maxEntrySize) {
            cachePopulatorStats.incrementOversized();
            return;
          }
        }
      }

      if (maxEntrySize > 0 && bytes.size() > maxEntrySize) {
        cachePopulatorStats.incrementOversized();
        return;
      }

      cache.put(cacheKey, bytes.toByteArray());
      cachePopulatorStats.incrementOk();
    }
    catch (Exception e) {
      log.warn(e, "Could not populate cache");
      cachePopulatorStats.incrementError();
    }
  }
}

View on GitHub (pinned to 9b90983fd2)