apache/druid · error · RuntimeException
Compression failed
Error message
Compression failed
What it means
Pac4jSessionStore.compress wraps GZIP compression of serialized session data destined for a cookie. GZIPOutputStream.write only throws IOException in genuinely exceptional situations since the output is an in-memory ByteArrayOutputStream, so this RuntimeException signals an unexpected internal failure (e.g. JVM-level stream corruption or OOM-adjacent conditions) rather than bad user input.
Solutions
- Inspect the cause chain (the IOException) to identify the underlying JVM resource problem
- Reduce the size of the data being stored in the session/cookie
- Check JVM heap availability and GC health at time of failure
- Retry the request; this is almost never deterministic
Defensive patterns
Strategy: try-catch
Try / catch
try { byte[] compressed = store.compressEncryptBase64(obj); } catch (RuntimeException e) { LOGGER.error(e, "Session compression failed"); /* fail request or drop session */ } Prevention
- Keep cookie/session payloads small
- Monitor JVM heap health
- Alert on this exception; it should never fire in practice
When it happens
Trigger: Calling compressEncryptBase64 on a serialized session object while the internal GZIP write fails; practically only when the JVM is in a broken state (e.g. OutOfMemoryError surfaced as IOException) since both streams are in-memory.
Common situations: Very large session/profile objects stressing memory during cookie persistence; JVM resource exhaustion; rare JDK stream bugs.
Related errors
- Decompression failed
- Cannot list files in directory
- Column capacity exceeded
- Directory compression not supported for
- Directory decompression not supported for
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/b77aea8e8c3691d4.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/Pac4jSessionStore.java:237
}
catch (Exception e) {
LOGGER.debug("Failed to decrypt cookie value: %s", e.getMessage());
throw InvalidInput.exception(e, "Decryption failed. Check service logs.");
}
}
return null;
}
private byte[] compress(final byte[] data)
{
try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(data.length)) {
try (GZIPOutputStream gzip = new GZIPOutputStream(byteStream)) {
gzip.write(data);
}
return byteStream.toByteArray();
}
catch (IOException ex) {
throw new RuntimeException("Compression failed", ex);
}
}
private byte[] uncompress(final byte[] data)
{
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
GZIPInputStream gzip = new GZIPInputStream(inputStream)) {
return ByteStreams.toByteArray(gzip);
}
catch (IOException ex) {
throw new RuntimeException("Decompression failed", ex);
}
}
/**
* Serialize object using standard Java serialization
*/
private byte[] serializeToBytes(Serializable obj)View on GitHub (pinned to 9b90983fd2)