GraalVM version: CE 1.0.0-rc3
Even when I try to list expert options with:
native-image --expert-options
I get following exception:
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
Steps to reproduce
I'm using following docker image:
docker run --rm -it tenshi/graalvm-native-image:1.0.0-rc3 --expert-options
Which was created with this Dockerfile (standard GraalVM distribution, I don't compile from source).
You can use following command to debug inside the container:
docker run --rm -it --entrypoint bash tenshi/graalvm-native-image
The GraalVM is installed in /usr/lib/graalvm/.
Can you please paste the output of native-image --verbose --expert-options
sure, here is the full output:
root@c2f04a09a8ff:/usr/lib/graalvm/bin# ./native-image --verbose --expert-options
Executing [
/usr/lib/graalvm/bin/java \
-Xbootclasspath/a:/usr/lib/graalvm/jre/lib/boot/graal-sdk.jar:/usr/lib/graalvm/jre/lib/boot/graaljs-scriptengine.jar \
-cp \
/usr/lib/graalvm/jre/lib/svm/builder/svm.jar:/usr/lib/graalvm/jre/lib/svm/builder/pointsto.jar:/usr/lib/graalvm/jre/lib/svm/builder/objectfile.jar:/usr/lib/graalvm/jre/lib/jvmci/jvmci-hotspot.jar:/usr/lib/graalvm/jre/lib/jvmci/jvmci-api.jar:/usr/lib/graalvm/jre/lib/jvmci/graal.jar:/usr/lib/graalvm/jre/lib/jvmci/graal-management.jar \
-server \
-d64 \
-noverify \
-XX:+UnlockExperimentalVMOptions \
-XX:+EnableJVMCI \
-XX:-UseJVMCIClassLoader \
-XX:+UseJVMCICompiler \
-Dgraal.CompileGraalWithC1Only=false \
-XX:CICompilerCount=2 \
-Dgraal.VerifyGraalGraphs=false \
-Dgraal.VerifyGraalGraphEdges=false \
-Dgraal.VerifyGraalPhasesSize=false \
-Dgraal.VerifyPhases=false \
-Dgraal.EagerSnippets=true \
-Xss10m \
-Xms1g \
-Xmx2538504192 \
-Duser.country=US \
-Duser.language=en \
-Dsubstratevm.version=dev \
-Dgraalvm.version=1.0.0-rc3 \
-Dorg.graalvm.version=1.0.0-rc3 \
-Dcom.oracle.graalvm.isaot=true \
-Djvmci.class.path.append=/usr/lib/graalvm/jre/lib/jvmci/graal.jar \
com.oracle.svm.hosted.NativeImageGeneratorRunner \
-imagecp \
/usr/lib/graalvm/jre/lib/boot/graal-sdk.jar:/usr/lib/graalvm/jre/lib/boot/graaljs-scriptengine.jar:/usr/lib/graalvm/jre/lib/svm/builder/svm.jar:/usr/lib/graalvm/jre/lib/svm/builder/pointsto.jar:/usr/lib/graalvm/jre/lib/svm/builder/objectfile.jar:/usr/lib/graalvm/jre/lib/jvmci/jvmci-hotspot.jar:/usr/lib/graalvm/jre/lib/jvmci/jvmci-api.jar:/usr/lib/graalvm/jre/lib/jvmci/graal.jar:/usr/lib/graalvm/jre/lib/jvmci/graal-management.jar:/usr/lib/graalvm/jre/lib/svm/library-support.jar:/usr/lib/graalvm/bin \
-watchpid \
13 \
-H:Path=/usr/lib/graalvm/bin \
-H:PrintFlags=User \
-R:PrintFlags=User \
-H:CLibraryPath=/usr/lib/graalvm/jre/lib/svm/clibraries/linux-amd64
]
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
Exception in thread "main" org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at com.oracle.svm.hosted.c.GraalAccess.getGraalCapability(GraalAccess.java:50)
at com.oracle.svm.hosted.c.GraalAccess.getOriginalTarget(GraalAccess.java:38)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.isValidArchitecture(NativeImageGeneratorRunner.java:161)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.verifyValidJavaVersionAndPlatform(NativeImageGeneratorRunner.java:318)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:170)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:363)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:104)
One more request for output: native-image --verbose --expert-options -J-XX:+PrintFlagsFinal | grep GC | grep Use
here we go:
root@c2f04a09a8ff:/usr/lib/graalvm/bin# ./native-image --verbose --expert-options -J-XX:+PrintFlagsFinal | grep GC | grep Use
bool ParGCUseLocalOverflow = false {product}
Exception in thread "main" org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at com.oracle.svm.hosted.c.GraalAccess.getGraalCapability(GraalAccess.java:50)
at com.oracle.svm.hosted.c.GraalAccess.getOriginalTarget(GraalAccess.java:38)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.isValidArchitecture(NativeImageGeneratorRunner.java:161)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.verifyValidJavaVersionAndPlatform(NativeImageGeneratorRunner.java:318)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:170)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:363)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:104)
hmmm... the output looked a bit strange. i adjusted grep like this:
root@c2f04a09a8ff:/usr/lib/graalvm/bin# ./native-image --verbose --expert-options -J-XX:+PrintFlagsFinal | grep 'GC.*Use\|Use.*GC'
bool ParGCUseLocalOverflow = false {product}
bool UseAdaptiveGCBoundary = false {product}
bool UseAdaptiveSizeDecayMajorGCCost = true {product}
bool UseAdaptiveSizePolicyWithSystemGC = false {product}
bool UseAutoGCSelectPolicy = false {product}
bool UseConcMarkSweepGC = false {product}
bool UseDynamicNumberOfGCThreads = false {product}
bool UseG1GC = false {product}
bool UseGCLogFileRotation = false {product}
bool UseGCOverheadLimit = true {product}
bool UseGCTaskAffinity = false {product}
bool UseMaximumCompactionOnSystemGC = true {product}
bool UseParNewGC = false {product}
bool UseParallelGC = false {product}
bool UseParallelOldGC = false {product}
bool UseSerialGC = false {product}
Exception in thread "main" org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at com.oracle.svm.hosted.c.GraalAccess.getGraalCapability(GraalAccess.java:50)
at com.oracle.svm.hosted.c.GraalAccess.getOriginalTarget(GraalAccess.java:38)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.isValidArchitecture(NativeImageGeneratorRunner.java:161)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.verifyValidJavaVersionAndPlatform(NativeImageGeneratorRunner.java:318)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:170)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:363)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:104)
This is what I get for CE 1.0.0-rc3 on my Linux VM:
dsimon@freddy ~> /usr/lib/jvm/graalvm-ce-1.0.0-rc3/bin/native-image --verbose --expert-options -J-XX:+PrintFlagsFinal | grep GC | grep Use
bool ParGCUseLocalOverflow = false {product}
bool UseAdaptiveGCBoundary = false {product}
bool UseAdaptiveSizeDecayMajorGCCost = true {product}
bool UseAdaptiveSizePolicyWithSystemGC = false {product}
bool UseAutoGCSelectPolicy = false {product}
bool UseConcMarkSweepGC = false {product}
bool UseDynamicNumberOfGCThreads = false {product}
bool UseG1GC = false {product}
bool UseGCLogFileRotation = false {product}
bool UseGCOverheadLimit = true {product}
bool UseGCTaskAffinity = false {product}
bool UseMaximumCompactionOnSystemGC = true {product}
bool UseParNewGC = false {product}
bool UseParallelGC := true {product}
bool UseParallelOldGC = true {product}
bool UseSerialGC = false {product}
As you can see, the ParallelGC is selected. Maybe you can look at the complete output of -J-XX:+PrintFlagsFinal to work out what GC is selected in your environment. The native-image command does not explicitly choose a GC.
It's interesting... looks like in my case none of the GC algorithms is selected. Do you know how the GC selection is done. maybe it is something in my environment that prevents any GC alg. from being selected?
Also, what does := mean? Does it signify that flag was explicitly set (has non-default value)? In my case I have it only for these flags:
bool BytecodeVerificationLocal := false {product}
bool BytecodeVerificationRemote := false {product}
intx CICompilerCount := 2 {product}
bool EnableJVMCI := true {JVMCI product}
uintx InitialHeapSize := 1073741824 {product}
uintx MaxHeapSize := 2539651072 {product}
uintx MaxNewSize := 846528512 {product}
uintx MinHeapDeltaBytes := 196608 {product}
uintx NewSize := 357892096 {product}
uintx OldSize := 715849728 {product}
bool PrintFlagsFinal := true {product}
intx ThreadStackSize := 10240 {pd product}
bool UnlockExperimentalVMOptions := true {experimental}
bool UseCompressedClassPointers := true {lp64_product}
bool UseCompressedOops := true {lp64_product}
bool UseJVMCIClassLoader := false {JVMCI product}
bool UseJVMCICompiler := true {JVMCI product}
In my previous investigation I also tried to find a way to explicitly set the GC alg. But I could not find a way to do it in the docs. How i know that it should be prefixed with -J. So this one works fine for me :tada:
./native-image --expert-options -J-XX:+UseParallelGC
But I still wonder why none of the GC alg. is selected by default and I need to specify it explicitly?
The := means the flag was explicitly set (on command line, via ergonomics or some other means):
It's very strange if no GC is selected:
https://github.com/graalvm/graal-jvmci-8/blob/b6258e95c1150ad7c30d11806c6a142104b2351c/src/share/vm/runtime/arguments.hpp#L612
https://github.com/graalvm/graal-jvmci-8/blob/e792ceafce15cac54b8c71231a1e4026f0a468ff/src/share/vm/runtime/arguments.cpp#L1583-L1587
:thinking: maybe os::is_server_class_machine() can be the reason (in select_gc_ergonomically)?
I wonder whether this is related: https://bugs.openjdk.java.net/browse/JDK-8149185
Yes, that looks likely. However, it seems weird that you have even start a VM with no GC selected.
@Peter-B-Kessler can you shed any further light on this?
At this point I probably should mention that I currently testing it as a docker container and the host OS is Windows 8, docker runs via docker-machine. My setup is currently a bit convoluted :) It is possible that docker machine has very little resources and runs as a guest (although I gave it 3 GB memory). On the other hand, rc1 was working fine with this setup. I can also test it tomorrow on my macbook.
I think I just verified it. I had the the default number of CPUs for my docker-machine = 1. After giving it more CPUs (3) everything works fine and I see automatically selected GC:
root@68c356974bf9:/project# /usr/lib/graalvm/bin/native-image --verbose --expert-options -J-XX:+PrintFlagsFinal | grep UseParallelGC
bool UseParallelGC := true
Here's what I get from graalvm-ee-1.0.0-rc3-dev native-imageon my MacBookPro:
graalvm-ee-1.0.0-rc3-dev/Contents/Home $ bin/native-image --verbose --expert-options -J-XX:+PrintFlagsFinal | grep 'GC.*Use\|Use.*GC'
bool ParGCUseLocalOverflow = false {product}
bool UseAdaptiveGCBoundary = false {product}
bool UseAdaptiveSizeDecayMajorGCCost = true {product}
bool UseAdaptiveSizePolicyWithSystemGC = false {product}
bool UseAutoGCSelectPolicy = false {product}
bool UseConcMarkSweepGC = false {product}
bool UseDynamicNumberOfGCThreads = false {product}
bool UseG1GC = false {product}
bool UseGCLogFileRotation = false {product}
bool UseGCOverheadLimit = true {product}
bool UseGCTaskAffinity = false {product}
bool UseMaximumCompactionOnSystemGC = true {product}
bool UseParNewGC = false {product}
bool UseParallelGC := true {product}
bool UseParallelOldGC = true {product}
bool UseSerialGC = false {product}
which matches what Doug sees on his Linux machine.
Does your docker container have more than one processor? If not, it will not qualify as a "server-class" machine. I can simulate that by passing an additional flag
graalvm-ee-1.0.0-rc3-dev/Contents/Home $ bin/native-image --verbose --expert-options -J-XX:+PrintFlagsFinal -J-XX:+NeverActAsServerClassMachine | grep 'GC.*Use\|Use.*GC'
bool ParGCUseLocalOverflow = false {product}
bool UseAdaptiveGCBoundary = false {product}
bool UseAdaptiveSizeDecayMajorGCCost = true {product}
bool UseAdaptiveSizePolicyWithSystemGC = false {product}
bool UseAutoGCSelectPolicy = false {product}
bool UseConcMarkSweepGC = false {product}
bool UseDynamicNumberOfGCThreads = false {product}
bool UseG1GC = false {product}
bool UseGCLogFileRotation = false {product}
bool UseGCOverheadLimit = true {product}
bool UseGCTaskAffinity = false {product}
bool UseMaximumCompactionOnSystemGC = true {product}
bool UseParNewGC = false {product}
bool UseParallelGC = false {product}
bool UseParallelOldGC = false {product}
bool UseSerialGC = false {product}
Exception in thread "main" org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at com.oracle.svm.hosted.c.GraalAccess.getGraalCapability(GraalAccess.java:50)
at com.oracle.svm.hosted.c.GraalAccess.getOriginalTarget(GraalAccess.java:38)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.isValidArchitecture(NativeImageGeneratorRunner.java:161)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.verifyValidJavaVersionAndPlatform(NativeImageGeneratorRunner.java:318)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:170)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:363)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:104)
Error: Image building with exit status 1
which looks like the original problem. If GraalVM does not support the serial collector, but finds itself on a non-server-class machine os::is_server_class_machine(), then it apparently does not get a collector at all. Not a nice error message, though.
The -XX:+UseParallelGC collector runs okay with a single thread: -XX:+UseParallelGC -XX:ParallelGCThreads=1, and you might not even have to tell it how many threads to use in your Docker container.
:+1: thanks a lot, everybody! I think this is it. The root cause was the number of CPUs: if machine has only 1 CPU, then GC is not selected automatically.
I'm not sure how wide-spread this situation might be, but maybe it would make sense to either improve the error message, make a note about this in the docs or add some meaningful default for this scenario (like mentioned -XX:+UseParallelGC -XX:ParallelGCThreads=1). But I don't have a strong opinion on either of these options.
Maybe a workaround for @dougxc is to set -XX:+AlwaysActAsServerClassMachine, which should have Arguments::select_gc_ergonomically() choose the -XX:+UseParallelGC collector if there is not one chosen on the command line.
The primary question for me is what GC is actually used if none of the GC command line arguments are set? Is it serial GC? Or no GC?! I can't find any API in the VM to answer the question "what GC are you using?" other than querying the flags.
If I understand Universe::initialize_heap correctly, the default is SerialGC. In the current JDK code base, a flag is guaranteed to be set or the VM will exit. Based on this, I'll make Graal default to SerialGC as well if no GC flags are set.
I agree with your analysis of Universe::initialize_heap: that the default gc_policy is the same as if -XX:+UseSerialGC were set on the command line.
If it is any consolation, I see
$ graalvm-ee-1.0.0-rc3-dev/Contents/Home/bin/java -XX:+PrintFlagsFinal -XX:+NeverActAsServerClassMachine -version | grep '\<Use.*GC\>' | grep -v 'SystemGC'
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
GraalVM 1.0.0-rc3-dev (build 25.71-b01-internal-jvmci-0.45, mixed mode)
bool UseConcMarkSweepGC = false {product}
bool UseG1GC = false {product}
bool UseParNewGC = false {product}
bool UseParallelGC = false {product}
bool UseParallelOldGC = false {product}
bool UseSerialGC = false {product}
That is, on an explicitly non-server-class machine, with no GC requested on the command line, none of the command line GC flags is set. I find it surprising that the choice of the default collector is not represented in the setting of the flags, the way it is on a server-class machine.
But
$ graalvm-ee-1.0.0-rc3-dev/Contents/Home/bin/java -XX:+NeverActAsServerClassMachine -XX:+PrintGCDetails -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
GraalVM 1.0.0-rc3-dev (build 25.71-b01-internal-jvmci-0.45, mixed mode)
Heap
def new generation total 78656K, used 2798K [0x00000006c0000000, 0x00000006c5550000, 0x0000000715550000)
eden space 69952K, 4% used [0x00000006c0000000, 0x00000006c02bb9d8, 0x00000006c4450000)
from space 8704K, 0% used [0x00000006c4450000, 0x00000006c4450000, 0x00000006c4cd0000)
to space 8704K, 0% used [0x00000006c4cd0000, 0x00000006c4cd0000, 0x00000006c5550000)
tenured generation total 174784K, used 0K [0x0000000715550000, 0x0000000720000000, 0x00000007c0000000)
the space 174784K, 0% used [0x0000000715550000, 0x0000000715550000, 0x0000000715550200, 0x0000000720000000)
Metaspace used 2233K, capacity 4480K, committed 4480K, reserved 1056768K
class space used 243K, capacity 384K, committed 384K, reserved 1048576K
I do have a collector, and I can tell that it is the one I would get with -XX:+UseSerialGC: a "def new" young generation and a "tenured" old generation.
Hi, I am getting the exact same error message at least 20 times per second while running my project :
org.graalvm.compiler.debug.GraalError: <unknown> garbage collector is not supported by Graal
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:205)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:145)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:123)
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:47)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:360)
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:448)
I installed GraalVM Community Edition 1.0 RC4 while following the getting started guide. I am running it on an Oracle VM VirtualBox with Ubuntu 18.04.1 LTS.
The project runs fine on a classic jdk 8 on the same machine, but with Graal it becomes extremely slow (due to the error messages flow and/or GC issues I would guess).
With a simple HelloWorld.java it still compiles and run but with tens of this message showing up.
I gave 8GB of RAM to the VirtualBox VM since it may have been an issue as mentioned.
I tried compiling with javac then running with java on a terminal. I also tried running my project on NetBeans. But since the problem happens at compilation and at runtime, I cannot figure out how to set up -XX:+UseSerialGC or -XX:+UseParallelGC on javac since this is not an existing option.
@BMerliot Have you also increased number of CPUs in the VirtualBox for your image? This helped in my case.
I increased from 1 to 4 CPUs and it worked, thanks a lot!
This was fixed in https://github.com/oracle/graal/commit/0cae23fcb80cd664e9b5d2beb7ebc594ca566bda, and should be in GraalVM Community Edition 1.0 RC5.
If you do not have a "server class" (virtual) machine you will now get the -XX:+UseSerialGC collector.
Thank you very much! I think the issue is now resolved.
Most helpful comment
This was fixed in https://github.com/oracle/graal/commit/0cae23fcb80cd664e9b5d2beb7ebc594ca566bda, and should be in GraalVM Community Edition 1.0 RC5.
If you do not have a "server class" (virtual) machine you will now get the -XX:+UseSerialGC collector.