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

GraalVM 23 on Windows: VMError$HostedError: should not reach here: unexpected input could not be handled: linkToNative (possibly caused by Quarkus setup) #9727

Open
jhutting opened this issue Sep 23, 2024 · 14 comments
Assignees

Comments

@jhutting
Copy link

Describe the issue
Native builds on Windows no longer work after upgrading to GraalVM 23+37.1 from 22.0.1+8.1 on my pc. The latest 24-ea build throws the same error: VMError$HostedError: should not reach here: unexpected input could not be handled: linkToNative (full stack below)
Building the native on Linux on the same machine works without issue, no issues on a M2 Mac with this version either. I can still build the executable on Windows using GraalVM 22.0.1+8.1

This seems restricted to Quarkus builds, native code with Spring does not throw the error but that could be related to using the native:compile plugin directly with Spring.

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. git clone --depth 1 https://github.com/Paladijn/D2Rcharviewer.git
  2. validate JAVA_HOME/GRAALVM_HOME and PATH contain the right JVM.
  3. mvn package -Dnative

Exactly the same outcome with this project:

  1. git clone --depth 1 https://github.com/jhutting/green-native.git
  2. validate JAVA_HOME/GRAALVM_HOME and PATH contain the right JVM.
  3. cd native-code-with-quarkus
  4. mvn package -Dnative
  5. the native-demo-spring folder in the same project runs fine with mvn native:compile -Pnative

Describe GraalVM and your environment:

  • GraalVM version: 23+37.1
  • JDK major version: 23 (though maven.compiler.release compatibility is still set to 21)
  • OS: Windows 10 22H2 19045.4894
  • hardware: [email protected] GHz, 24 gb memory (yes, it's old. I only use it for games, building native images and toying around with docker in Linux)

More details
--native-image-info resulted in:

Using native toolchain:
   Name: C/C++ Optimizing Compiler (cl)
   Vendor: microsoft
   Version: 19.41.34120
   Target architecture: x64
   Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\cl.exe
Using CLibrary: com.oracle.svm.core.c.libc.NoLibC

If you need me to run the build with other parameters, feel free to reach out.

Stacktrace on D2Rcharviewer

------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                    (8.7s @ 0.15GB)
 Java version: 23+37, vendor version: Oracle GraalVM 23+37.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
 C compiler: cl.exe (microsoft, x64, 19.41.34120)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 3 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
------------------------------------------------------------------------------------------------------------------------
 4 experimental option(s) unlocked:
 - '-H:+AllowFoldMethods' (origin(s): command line)
 - '-H:BuildOutputJSONFile' (origin(s): command line)
 - '-H:-UseServiceLoaderFeature' (origin(s): command line)
 - '-H:+GenerateBuildArtifactsFile' (origin(s): command line)
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 15.68GB of memory (65.5% of 23.94GB system memory, determined at start)
 - 4 thread(s) (100.0% of 4 available processor(s), determined at start)
[2/8] Performing analysis...  []                                                                        (16.6s @ 0.39GB)
    4,231 reachable types   (64.7% of    6,541 total)
    4,066 reachable fields  (33.0% of   12,324 total)
   16,647 reachable methods (34.5% of   48,294 total)
    1,481 types,    30 fields, and   336 methods registered for reflection
        1 native library: psapi

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing jdk.internal.foreign.abi.DowncallStub/0x00000000bc354400.invoke(Unknown Source)
Parsing context:
   at jdk.internal.org.jline.terminal.impl.ffm.Kernel32.GetConsoleScreenBufferInfo(Kernel32.java:224)
   at jdk.internal.org.jline.terminal.impl.ffm.WindowsAnsiWriter.getConsoleInfo(WindowsAnsiWriter.java:95)
   at jdk.internal.org.jline.terminal.impl.ffm.WindowsAnsiWriter.processEraseScreen(WindowsAnsiWriter.java:144)
   at jdk.internal.org.jline.utils.AnsiWriter.processEscapeCommand(AnsiWriter.java:291)
   at jdk.internal.org.jline.utils.AnsiWriter.write(AnsiWriter.java:134)
   at jdk.internal.org.jline.utils.AnsiWriter.write(AnsiWriter.java:773)
   at java.io.Writer.write(Writer.java:242)
   at jdk.internal.org.jline.utils.AnsiWriter.close(AnsiWriter.java:787)
   at java.io.FileDescriptor.closeAll(FileDescriptor.java:352)
   at java.io.FileOutputStream.close(FileOutputStream.java:445)
   at java.io.FilterOutputStream.close(FilterOutputStream.java:193)
   at java.io.PrintStream.implClose(PrintStream.java:504)
   at java.io.PrintStream.close(PrintStream.java:494)
   at sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:396)
   at sun.nio.cs.StreamEncoder.lockedClose(StreamEncoder.java:231)
   at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:216)
   at java.io.OutputStreamWriter.close(OutputStreamWriter.java:268)
   at org.jboss.logmanager.handlers.WriterHandler.safeClose(WriterHandler.java:244)
   at org.jboss.logmanager.handlers.OutputStreamHandler.setOutputStream(OutputStreamHandler.java:130)
   at org.jboss.logmanager.handlers.ConsoleHandler.setOutputStream(ConsoleHandler.java:252)
   at org.jboss.logmanager.handlers.ConsoleHandler.<init>(ConsoleHandler.java:108)
   at com.oracle.svm.core.code.FactoryMethodHolder.ConsoleHandler_jiIwUMHshiF60aNld5tXmG(generated:0)
   at io.quarkus.bootstrap.logging.InitialConfigurator.createDefaultHandler(InitialConfigurator.java:69)
   at io.quarkus.bootstrap.logging.InitialConfigurator.getInitialHandlers(InitialConfigurator.java:53)
   at org.jboss.logmanager.LoggerNode.getHandlers(LoggerNode.java:386)
   at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:435)
   at org.jboss.logmanager.Logger.logRaw(Logger.java:1089)
   at org.jboss.logmanager.Logger.log(Logger.java:1052)
   at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:56)
   at org.jboss.logging.Logger.debugf(Logger.java:714)
   at io.quarkus.runtime.ApplicationLifecycleManager$1.accept(ApplicationLifecycleManager.java:57)
   at io.quarkus.runtime.ApplicationLifecycleManager$1.accept(ApplicationLifecycleManager.java:53)
   at io.quarkus.runtime.Quarkus.run(Quarkus.java:80)
   at com.oracle.svm.core.JavaMainWrapper.invokeMain(JavaMainWrapper.java:181)
   at com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:232)
   at com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:299)
   at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_XNhh1mz2Ib2aPR1wdv014D(generated:0)
   at static root method.(Unknown Source)

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:165)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:184)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:152)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:110)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultStaticInvokeTypeFlow.lambda$update$0(DefaultStaticInvokeTypeFlow.java:75)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.LightImmutableCollection.forEach(LightImmutableCollection.java:90)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultStaticInvokeTypeFlow.update(DefaultStaticInvokeTypeFlow.java:74)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:575)
        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.externalHelpQuiesce(ForkJoinPool.java:2535)
        at java.base/java.util.concurrent.ForkJoinPool.helpQuiescePool(ForkJoinPool.java:2569)
        at java.base/java.util.concurrent.ForkJoinPool.awaitQuiescence(ForkJoinPool.java:3808)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.complete(CompletionExecutor.java:208)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis.doTypeflow(PointsToAnalysis.java:613)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis.finish(PointsToAnalysis.java:601)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:157)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:832)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:554)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:528)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:711)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:139)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
Caused by: com.oracle.svm.core.util.VMError$HostedError: should not reach here: unexpected input could not be handled: linkToNative
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHereUnexpectedInput(VMError.java:97)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.PolymorphicSignatureWrapperMethod.buildGraph(PolymorphicSignatureWrapperMethod.java:170)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.SubstitutionMethod.buildGraph(SubstitutionMethod.java:122)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:657)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:108)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:916)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:881)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:864)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:181)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1215)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1198)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1053)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1005)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:991)
        at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:926)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:269)
        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.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:73)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:200)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:652)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
        ... 26 more
------------------------------------------------------------------------------------------------------------------------
                        1.1s (3.9% of total time) in 76 GCs | Peak RSS: 0.86GB | CPU load: 3.35
========================================================================================================================
Failed generating 'd2rcharviewer-0.0.6-SNAPSHOT-runner' after 26.1s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  43.017 s
[INFO] Finished at: 2024-09-22T20:53:38+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.14.4:build (default) on project d2rcharviewer: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:489)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:278)
[ERROR]         at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:1575)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:483)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

(-X and --verbose on quarkus.native.additional-build-args only resulted in more quarkus output that the build failed)

Stacktrace on the green IT example:

------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                   (13.1s @ 0.21GB)
 Java version: 23+37, vendor version: Oracle GraalVM 23+37.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
 C compiler: cl.exe (microsoft, x64, 19.41.34120)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 8 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature
 - io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - io.quarkus.jdbc.h2.runtime.H2Reflections: Support for H2 Database's extended data types
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - org.eclipse.angus.activation.nativeimage.AngusActivationFeature
 - org.hibernate.graalvm.internal.GraalVMStaticFeature: Hibernate ORM's static reflection registrations for GraalVM
------------------------------------------------------------------------------------------------------------------------
 4 experimental option(s) unlocked:
 - '-H:+AllowFoldMethods' (origin(s): command line)
 - '-H:BuildOutputJSONFile' (origin(s): command line)
 - '-H:-UseServiceLoaderFeature' (origin(s): command line)
 - '-H:+GenerateBuildArtifactsFile' (origin(s): command line)
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 15.46GB of memory (64.6% of 23.94GB system memory, determined at start)
 - 4 thread(s) (100.0% of 4 available processor(s), determined at start)
18:28:55,837 INFO  [org.hib.orm.con.pooling] HHH10001005: Database info:
        Database JDBC URL [undefined/unknown]
        Database driver: undefined/unknown
        Database version: 2.3.230
        Autocommit mode: undefined/unknown
        Isolation level: <unknown>
        Minimum pool size: undefined/unknown
        Maximum pool size: undefined/unknown
[2/8] Performing analysis...  []                                                                        (16.7s @ 0.45GB)
    4,603 reachable types   (59.8% of    7,698 total)
    3,814 reachable fields  (30.1% of   12,662 total)
   14,765 reachable methods (27.9% of   53,007 total)
    1,910 types,    25 fields, and   493 methods registered for reflection

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing jdk.internal.foreign.abi.DowncallStub/0x000000002af4d400.invoke(Unknown Source)
Parsing context:
   at jdk.internal.org.jline.terminal.impl.ffm.Kernel32.GetConsoleScreenBufferInfo(Kernel32.java:224)
   at jdk.internal.org.jline.terminal.impl.ffm.WindowsAnsiWriter.getConsoleInfo(WindowsAnsiWriter.java:95)
   at jdk.internal.org.jline.terminal.impl.ffm.WindowsAnsiWriter.processCursorUp(WindowsAnsiWriter.java:260)
   at jdk.internal.org.jline.utils.AnsiWriter.processEscapeCommand(AnsiWriter.java:266)
   at jdk.internal.org.jline.utils.AnsiWriter.write(AnsiWriter.java:150)
   at jdk.internal.org.jline.utils.AnsiWriter.write(AnsiWriter.java:781)
   at java.io.Writer.write(Writer.java:278)
   at java.io.PrintStream.implWrite(PrintStream.java:812)
   at java.io.PrintStream.write(PrintStream.java:798)
   at java.io.PrintStream.print(PrintStream.java:1004)
   at com.oracle.svm.core.MissingRegistrationUtils.report(MissingRegistrationUtils.java:102)
   at com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.report(MissingReflectionRegistrationUtils.java:152)
   at com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forClass(MissingReflectionRegistrationUtils.java:49)
   at com.oracle.svm.core.hub.DynamicHub.arrayType(DynamicHub.java:1678)
   at sun.reflect.generics.factory.CoreReflectionFactory.makeArrayType(CoreReflectionFactory.java:122)
   at sun.reflect.generics.visitor.Reifier.visitArrayTypeSignature(Reifier.java:161)
   at sun.reflect.generics.tree.ArrayTypeSignature.accept(ArrayTypeSignature.java:42)
   at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
   at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:148)
   at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
   at sun.reflect.generics.repository.ClassRepository.computeSuperInterfaces(ClassRepository.java:117)
   at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:95)
   at java.lang.Class.getGenericInterfaces(Class.java:1385)
   at java.util.HashMap.comparableClassFor(HashMap.java:350)
   at java.util.HashMap$TreeNode.treeify(HashMap.java:2094)
   at java.util.HashMap.treeifyBin(HashMap.java:779)
   at java.util.HashMap.putVal(HashMap.java:651)
   at java.util.HashMap.put(HashMap.java:619)
   at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:131)
   at com.oracle.svm.core.code.FactoryMethodHolder.AnnotationType_VfB9bisU231Yp5COvUErg9(generated:0)
   at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
   at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:124)
   at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
   at java.lang.reflect.Executable.declaredAnnotations(Executable.java:667)
   at java.lang.reflect.Executable.getAnnotation(Executable.java:633)
   at java.lang.reflect.Method.getAnnotation(Method.java:793)
   at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:292)
   at jdk.internal.reflect.Reflection.isCallerSensitive(Reflection.java:351)
   at java.lang.reflect.Method.isCallerSensitive(Method.java:618)
   at java.lang.reflect.Method.invoke(Method.java:561)
   at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:490)
   at static root method.(Unknown Source)

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:165)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:184)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:152)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:110)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultStaticInvokeTypeFlow.lambda$update$0(DefaultStaticInvokeTypeFlow.java:75)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.LightImmutableCollection.forEach(LightImmutableCollection.java:90)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultStaticInvokeTypeFlow.update(DefaultStaticInvokeTypeFlow.java:74)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:575)
        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)
Caused by: com.oracle.svm.core.util.VMError$HostedError: should not reach here: unexpected input could not be handled: linkToNative
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHereUnexpectedInput(VMError.java:97)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.PolymorphicSignatureWrapperMethod.buildGraph(PolymorphicSignatureWrapperMethod.java:170)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.SubstitutionMethod.buildGraph(SubstitutionMethod.java:122)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:657)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:108)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:916)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:881)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:864)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:181)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1215)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1198)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1053)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1005)
        at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:991)
        at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:926)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:269)
        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.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:73)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:200)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:652)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
        ... 15 more
------------------------------------------------------------------------------------------------------------------------
                        1.3s (4.0% of total time) in 96 GCs | Peak RSS: 1.03GB | CPU load: 3.07
========================================================================================================================
Failed generating 'native-code-with-quarkus-1.0.0-SNAPSHOT-runner' after 31.3s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:08 min
[INFO] Finished at: 2024-09-22T18:29:12+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.14.4:build (default) on project native-code-with-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:489)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:278)
[ERROR]         at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:1575)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:483)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
@selhagani
Copy link
Member

Hi @jhutting,

Thank you for reaching out to us! We'll take a look into this shortly and I'll keep you updated

@jhutting
Copy link
Author

@selhagani any update on this? I'd like to share build times and resource usage during my talk at Devoxx next week, and considering the newer versions perform better in those aspects would prefer to use 23 or 24-ea.

If I need to run with different flags to generate extra information just let me know. I currently don't know if the issue only occurs on my ancient i5 or also on more modern machines, just that GraalVM 21 and 22 don't have the issue.

@selhagani
Copy link
Member

I tested with GraalVM for JDK 22 and it did indeed work but with GraalVM for JDK 23 I am getting a different error than the one you shared. This is the error I get [INFO] --- quarkus:3.14.4:build (default) @ d2rcharviewer --- [WARNING] [io.quarkus.deployment.configuration] Configuration property 'quarkus.package.type' has been deprecated and replaced by: [quarkus.package.jar.enabled, quarkus.package.jar.type, quarkus.native.enabled, quarkus.native.sources-only] [INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: C:\Users\AOUBIDAR\dev\graal_issues\github\9727\D2Rcharviewer\target\d2rcharviewer-0.0.6-SNAPSHOT-native-image-source-jar\d2rcharviewer-0.0.6-SNAPSHOT-runner.jar [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\Users\AOUBIDAR\dev\graal_issues\github\9727\D2Rcharviewer\target\d2rcharviewer-0.0.6-SNAPSHOT-native-image-source-jar\d2rcharviewer-0.0.6-SNAPSHOT-runner.jar [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GRAALVM 24.1 JDK 23+37-jvmci-b01 [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] C:\Users\AOUBIDAR\dev\GraalVM\graalvm-jdk-23+37.1\bin\native-image.cmd -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dlogging.initial-configurator.min-level=500 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=GB -J-Dfile.encoding=UTF-8 --features=io.quarkus.runner.Feature,io.quarkus.runtime.graal.DisableLoggingFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-exports=java.security.jgss/sun.security.jgss=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+UnlockExperimentalVMOptions -H:BuildOutputJSONFile=d2rcharviewer-0.0.6-SNAPSHOT-runner-build-output-stats.json -H:-UnlockExperimentalVMOptions -H:+UnlockExperimentalVMOptions -H:+GenerateBuildArtifactsFile -H:-UnlockExperimentalVMOptions -H:+UnlockExperimentalVMOptions -H:+AllowFoldMethods -H:-UnlockExperimentalVMOptions -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+UnlockExperimentalVMOptions -H:+ReportExceptionStackTraces -H:-UnlockExperimentalVMOptions -H:-AddAllCharsets --enable-url-protocols=http --enable-monitoring=heapdump -H:+UnlockExperimentalVMOptions -H:-UseServiceLoaderFeature -H:-UnlockExperimentalVMOptions -J--add-exports=org.graalvm.nativeimage/org.graalvm.nativeimage.impl=ALL-UNNAMED --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json d2rcharviewer-0.0.6-SNAPSHOT-runner -jar d2rcharviewer-0.0.6-SNAPSHOT-runner.jar Exception in thread "main" java.lang.NullPointerException at java.base@23/java.util.Objects.requireNonNull(Objects.java:220) at java.base@23/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:215) at java.base@23/java.nio.file.Path.of(Path.java:148) at java.base@23/java.nio.file.Paths.get(Paths.java:69) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.WindowsBuildEnvironmentUtil.findVCVarsallWithVSWhere(WindowsBuildEnvironmentUtil.java:114) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.WindowsBuildEnvironmentUtil.propagateEnv(WindowsBuildEnvironmentUtil.java:53) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.buildImage(NativeImage.java:1689) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.completeImageBuild(NativeImage.java:1329) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1882) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1847) at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1829) at java.base@23/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21:13 min [INFO] Finished at: 2024-09-30T16:21:40+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.14.4:build (default) on project d2rcharviewer: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1 [ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:489) [ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:278) [ERROR] at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) [ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:256) [ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) [ERROR] at java.base/java.lang.Thread.run(Thread.java:1575) [ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:483) [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. Do you have any idea why I am getting a different error please?

@jhutting
Copy link
Author

@selhagani your issue seems to be caused by a vsvars/vswhere issue as also described in #8669 and might be an issue with how you set up visual studio - see Fabio's comment on March 31st.
I've used https://www.graalvm.org/latest/getting-started/windows/ to set up my Windows machine for the native builds (also referring to that in docs/build.md)

FWIW: I have the following components installed (using the linked instructions as a guideline). Perhaps your issue is caused by either not installing the visual studio editor as the user in #8669 or by not selecting the C++/CLI support for v143 build tools.
image

Apparently there's also a new Windows 10 SDK (20348) available, do you want me to try with that version?

@selhagani
Copy link
Member

Hi @jhutting, thank you for the provided suggestion.
I have confirmed that the required installation is complete, including the addition of C++/CLI support for the v143 build tools. However, the issue persists. I also tested it on a different Windows machine, but unfortunately, I am still encountering the same error message I previously shared, rather than the one you reported.

@Quentigus
Copy link

Hi,
I'm facing the same error, with Visual Studio configured at the same way.

@jhutting
Copy link
Author

jhutting commented Oct 4, 2024

@selhagani I consistently get the same error on other Quarkus project as well, I haven't seen the nullpointer you're experiencing. Just created a minimal hello world REST example which should be faster to build and uploaded it here: https://github.com/jhutting/quarkus-hello

Are there any settings or flags I can try to add/adjust in the build?

@Karm
Copy link
Contributor

Karm commented Oct 8, 2024

I can confirm the error when manually executing on Windows 2019 sever

C:\tmp
λ curl -O -J -L https://github.com/graalvm/mandrel/releases/download/mandrel-24.1.0.0-Final/mandrel-java23-windows-amd64-24.1.0.0-Final.zip
λ powershell -c "Expand-Archive -Path mandrel-java23-windows-amd64-24.1.0.0-Final.zip -DestinationPath . -Force
λ SET JAVA_HOME=C:\tmp\mandrel-java23-24.1.0.0-Final\
λ SET GRAALVM_HOME=%JAVA_HOME%
λ SET PATH=%JAVA_HOME%\bin;%PATH%

λ curl -O -J -L "https://code.quarkus.io/d?e=rest&cn=code.quarkus.io"
λ powershell -c "Expand-Archive -Path code-with-quarkus.zip -DestinationPath . -Force
λ cd code-with-quarkus\
C:\tmp\code-with-quarkus
λ vcvars64
λ mvnw package -Dnative

And yet, it completed in CI before. I can see Jenkins CI passing with exactly the same build that fails for me manually. /me investigating... It's gonna be some setup.

@zakkak zakkak added quarkus quarkus related issue redhat-interest labels Oct 8, 2024
@zakkak
Copy link
Collaborator

zakkak commented Oct 8, 2024

According to the documentation of jline since 3.24 by default it will use the FFM implementation when running on JDK >= 22. On native-image however FFM is not enabled by default, so we either need to pass -H:+ForeignAPISupport to native-image (assuming it supports everything required by jline) or make sure a different provider is used.

I have not checked why this is not an issue on Linux.

@Karm
Copy link
Contributor

Karm commented Oct 8, 2024

@zakkak The explanation of why this passed on CI is that the code path in Quarkus gets activated only when there is a real terminal attached. In batch mode, on CI, it is not triggered. I got momentarily confused by "JLine" but when I realized it's actually former JANSI it all clicked together as this is not our first problem in this area.
It does not show on Linux because highlighting and coloring output is handled much simpler there, merely by using terminal control symbols. No native lib needed on Linux.

I am still not sure why mvnw package -Dnative -Dquarkus.native.additional-build-args=-H:+ForeignAPISupport didn't help though. Gonna take a look at what we do with the library.

@jhutting TL;DR: I doubt this is GraalVM issue per se. We need to handle JLine lib correctly.

@Karm
Copy link
Contributor

Karm commented Oct 8, 2024

Quarkus tracker: quarkusio/quarkus#43777

@Karm
Copy link
Contributor

Karm commented Oct 16, 2024

@jhutting Based on my findings in #9884, I can share that opting-out of the new JLine JDK capability works-around the problem. The capability was opt-in in JDK 21 by setting -Djdk.console=jdk.internal.le and it is opt-out in e.g. JDK 23 as: -Djdk.console=jdk.base i.e.:

Quarkus
mvnw package -Dnative -Dquarkus.native.additional-build-args=-J-Djdk.console=jdk.base

@jhutting
Copy link
Author

@Karm sorry for the late reply, was kinda busy the past days.

I slightly had to adjust the workaround you propose by adding
quarkus.native.additional-build-args=-J-Djdk.console=jdk.base
to the src/resources/application.properties as the powershell terminal Intellij opens threw errors on an unknown lifecycle phase.

FWIW: the build also ran fine without -J, what does that flag do?

@Karm
Copy link
Contributor

Karm commented Oct 18, 2024

@jhutting I am glad it works for you.

-J prefix means the flag affects the JVM running the native-image build tool itself, not the resulting app.

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

5 participants