Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Native Image] GraalError: should not reach here: unexpected encoding: true true #10199

Open
1 task done
joggeli34 opened this issue Nov 29, 2024 · 1 comment
Open
1 task done
Assignees

Comments

@joggeli34
Copy link

Describe the Issue

I'm trying to build a project native and I am getting following error:

[1/8] Initializing...                                                                                    (4.6s @ 0.17GB)
 Java version: 23.0.1+11, vendor version: Oracle GraalVM 23.0.1+11.1
 Graal compiler: optimization level: b, target machine: armv8-a, PGO: off
 C compiler: cc (apple, arm64, 16.0.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 2 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - com.x.graalvm.XRegisterForReflectionFeature: Register annotated types for reflection
------------------------------------------------------------------------------------------------------------------------
 1 experimental option(s) unlocked:
 - '-H:+AllowDeprecatedBuilderClassesOnImageClasspath' (origin(s): command line)
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 26.49GB of memory (73.6% of 36.00GB system memory, determined at start)
 - 11 thread(s) (100.0% of 11 available processor(s), determined at start)
[main] INFO org.reflections.Reflections - Reflections took 46 ms to scan 15 urls, producing 8 keys and 171 values
[main] INFO com.x.graalvm.XRegisterForReflectionFeature - Registered 34 classes annotated with @XRegisterForReflection for reflection
[2/8] Performing analysis...  [*****]                                                                   (15.2s @ 1.34GB)
   14’866 reachable types   (83.6% of   17’774 total)
   25’803 reachable fields  (56.4% of   45’766 total)
   87’006 reachable methods (58.1% of  149’738 total)
    4’977 types,   116 fields, and   947 methods registered for reflection
       63 types,    60 fields, and    56 methods registered for JNI access
        5 native libraries: -framework CoreServices, -framework Foundation, dl, pthread, z
[3/8] Building universe...                                                                               (2.4s @ 1.55GB)
[4/8] Parsing methods...      [*]                                                                        (1.6s @ 1.68GB)
[5/8] Inlining methods...     [*]                                                                        (0.6s @ 1.81GB)

Fatal error: jdk.graal.compiler.debug.GraalError: should not reach here: unexpected encoding: true true
	at jdk.graal.compiler/jdk.graal.compiler.debug.GraalError.shouldNotReachHere(GraalError.java:57)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.FrameState$StackState.of(FrameState.java:132)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.ensureOuterStateDecoded(PEGraphDecoder.java:1697)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleFloatingNodeAfterAdd(PEGraphDecoder.java:1756)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.ensureNodeCreated(GraphDecoder.java:1579)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.makeFloatingNodeInputs(GraphDecoder.java:1535)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.decodeFloatingNode(GraphDecoder.java:1611)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.ensureNodeCreated(GraphDecoder.java:1562)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.makeFloatingNodeInputs(GraphDecoder.java:1535)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.decodeFloatingNode(GraphDecoder.java:1611)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.ensureNodeCreated(GraphDecoder.java:1562)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.makeFloatingNodeInputs(GraphDecoder.java:1535)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.decodeFloatingNode(GraphDecoder.java:1611)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.ensureOuterStateDecoded(PEGraphDecoder.java:1693)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleFloatingNodeAfterAdd(PEGraphDecoder.java:1756)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.ensureNodeCreated(GraphDecoder.java:1579)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.makeFixedNodeInputs(GraphDecoder.java:1491)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:801)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:654)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:895)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.code.CompileQueue$TrivialInlinePhase.run(CompileQueue.java:794)
	at jdk.graal.compiler/jdk.graal.compiler.phases.Phase.run(Phase.java:49)
	at jdk.graal.compiler/jdk.graal.compiler.phases.BasePhase.apply(BasePhase.java:468)
	at jdk.graal.compiler/jdk.graal.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.graal.compiler/jdk.graal.compiler.phases.Phase.apply(Phase.java:38)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.code.CompileQueue.doInlineTrivial(CompileQueue.java:827)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.code.CompileQueue$TrivialInlineTask.run(CompileQueue.java:331)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:166)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:152)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1726)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1717)
	at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1641)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1458)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2034)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:189)
------------------------------------------------------------------------------------------------------------------------
                        1.8s (7.2% of total time) in 414 GCs | Peak RSS: 2.50GB | CPU load: 7.43
========================================================================================================================
Failed generating 'data-server' after 25.1s.

Is there a option to get more information why this error occurs?

Interesting part: The project normally uses logback for logging. I just removed it for native build but first forgot to remove the prometheus LogbackMetrics(). Then it was able to build native, but failed on start due to not having some logback classes.
After removing the LogbackMetrics() I get the build error above.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

Java(TM) SE Runtime Environment Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23.0.1+11.1 (build 23.0.1+11-jvmci-b01, mixed mode, sharing)

Operating System and Version

Mac OS 15.1.1

Build Command

Using gradle with:

graalvmNative {
    toolchainDetection = true
    binaries {
        main {
            mainClass = "com.x.DataServerMain"
            buildArgs.add("-H:+AllowDeprecatedBuilderClassesOnImageClasspath")
            buildArgs.add("-Ob")
            verbose = true
            javaLauncher = javaToolchains.launcherFor {
                languageVersion = JavaLanguageVersion.of(23)
                vendor = JvmVendorSpec.matching("Oracle Corporation")
            }
        }
    }
}

Expected Behavior

The build went through or there are more instructions on the error

Actual Behavior

Fails with the error jdk.graal.compiler.debug.GraalError: should not reach here: unexpected encoding: true true

Steps to Reproduce

I don't know yet how to reproduce it on a small sharable project

Additional Context

No response

Build Log Output and Error Messages

No response

@fernando-valdez
Copy link
Member

Hello @joggeli34,
You can get more output information at build time with this arg:
buildArgs.add("--verbose")

Please confirm if you are creating the config files (ref here).
If you haven't, please check the documentation about it for gradle here.

Finally, not having a reproducer will make it very hard for us to understand the problem and get a solution for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants