Not all OpenJDK 12 builds include Shenandoah: Here’s why

OpenJDK 12 is now out, and it has new features. These are:

189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)

230: Microbenchmark Suite

325: Switch Expressions (Preview)

334: JVM Constants API

340: One AArch64 Port, Not Two

341: Default CDS Archives

344: Abortable Mixed Collections for G1

346: Promptly Return Unused Committed Memory from G1

When I follow the link from the OpenJDK 12 project page to the open source builds page, I see the downloadable binaries. I download the Linux binary and install it, then see if the first item on the feature list, Shenandoah, works:

$ ./jdk-12/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -cp ~ Hello Error occurred during initialization of VM Option -XX:+UseShenandoahGC not supported

Oh! What is going on?

Everything you need to grow your career. With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development. SIGN UP

A little history: Shenandoah, a high-performance low-pause-time garbage collector, is a Red Hat-led project. When we first proposed to contribute Shenandoah to OpenJDK, Oracle made it clear that they didn’t want to support it. That’s fair enough: OpenJDK is free software, so you don’t have to support anything you don’t want. We told Oracle that we’d work with them to design a really clean pluggable garbage-collector interface that allows anyone easily to select the garbage collectors to include in their builds. We did that together, and Shenandoah went in to JDK 12.

Evidently Oracle has chosen not to build Shenandoah. They aren’t doing anything strictly wrong by excluding it, but something doesn’t feel right to me. These builds aren’t supported by Oracle—you need their commercial binaries to get support—so why exclude Shenandoah? It might simply be that they used their standard build scripts to build their open source binaries. However, in a rather feature-light OpenJDK release, I find it odd for open source builds to exclude one of the most significant contributions. I really appreciate Oracle providing GPL-licensed OpenJDK builds, but I wish they’d build all of it.

All is not lost, though. If you want to try Shenandoah on Red Hat Enterprise Linux or Fedora, it’s supported on all of our builds from JDK 8 onward; just use the software installation tool or, for example,

$ yum install java-11-openjdk-devel

If you want to try JDK 12, packages for Fedora and Red Hat Enterprise Linux (via EPEL) will soon be available. For other systems, AdoptOpenJDK provides JDK 12 binaries, all of which support Shenandoah.