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
- Check cache backend health (memcached connectivity, memory) and fix the underlying put failure using the logged exception stack trace.
- Lower cache entry size limits or enable result chunking if large results exceed cache limits.
- Confirm the cache configuration (type, hosts, timeouts) in the query cache settings is correct.
- 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
- Keep cache entries under configured size limits
- Monitor cachePopulator error metrics
- Validate cache host config before rollout
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
- Expected 0 resource count, got
- Multiple monitors on the same cache causing race conditions…
- Unable to get SHA1 digest instance
- Unable to write to cache
- A-Not-B requires at least 1 sketch
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)