apache/druid · warning · java.lang.UnsupportedOperationException
Cleaning is not support on this platform, because internal…
Error message
Cleaning is not support on this platform, because internal Java APIs are not compatible with this Druid version
What it means
Cleaners.takeMeToTheCleaners builds a Cleaner abstraction over JDK internals (java.lang.ref.Cleaner on 9+, or a Java 8 fallback). If no compatible cleaning API can be found via reflection, it throws this UnsupportedOperationException. Buffer cleaning (eager deallocation) is unsupported on the current JVM.
Solutions
- Run on a standard, supported HotSpot OpenJDK (8 or 11+ per Druid's compatibility matrix).
- Avoid --illegal-access=deny style flags or remove module restrictions blocking jdk.internal.ref access.
- Catch UnsupportedOperationException at call sites (see Cleaners.register) and fall back to GC-based cleanup.
Example fix
// before
Cleaners.register(obj, cleanupRunnable);
// after
try {
Cleaners.register(obj, cleanupRunnable);
} catch (UnsupportedOperationException e) {
// cleaner unsupported; cleanup happens at GC
} Defensive patterns
Strategy: try-catch
Try / catch
try {
Cleanable c = Cleaners.register(obj, action);
} catch (UnsupportedOperationException e) {
// cleaner unsupported on this JVM; rely on GC/close
} Prevention
- Pin deployments to supported JDK vendors/versions
- Avoid jlink images that drop java.base internals
- Never rely solely on cleaners for correctness of cleanup
When it happens
Trigger: Static initialization of Cleaners on a JVM where neither jdk.internal.ref.Cleaner (Java 9+ path) nor the Java 8 sun.misc path can be resolved, e.g. non-HotSpot JVMs, heavily restricted module settings, or stripped JDK images.
Common situations: Running Druid on unusual/locked-down Java runtimes; custom minimal JRE images (jlink) missing java.base internals; JVM vendors blocking deep reflection; the first use of Cleaners-dependent code triggering static init.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- CLEANER_NOT_SUPPORTED_EXCEPTION
- Unable to create cleaner
- Unable to register cleaning action
- Unable to run cleaning action
- Unmapping is not supported on this platform, because…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/e1dc5dcf10c046a0.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/java/util/common/Cleaners.java:66
exception = e;
}
if (cleaner != null) {
CLEANER = cleaner;
CLEANER_NOT_SUPPORTED_EXCEPTION = null;
} else {
CLEANER = null;
CLEANER_NOT_SUPPORTED_EXCEPTION = exception;
}
}
private static Cleaner takeMeToTheCleaners()
{
final MethodHandles.Lookup lookup = MethodHandles.lookup();
try {
return lookupCleaner(lookup);
}
catch (ReflectiveOperationException | RuntimeException e) {
throw new UnsupportedOperationException("Cleaning is not support on this platform, because internal " +
"Java APIs are not compatible with this Druid version", e);
}
}
private static Cleaner lookupCleaner(MethodHandles.Lookup lookup) throws ReflectiveOperationException
{
Class<?> cleaner = Class.forName("java.lang.ref.Cleaner");
Class<?> cleanable = Class.forName("java.lang.ref.Cleaner$Cleanable");
MethodHandle create = lookup.findStatic(cleaner, "create", MethodType.methodType(cleaner));
Object theCleaner;
try {
theCleaner = create.invoke();
}
catch (Throwable t) {
throw new RuntimeException("Unable to create cleaner", t);
}View on GitHub (pinned to 9b90983fd2)