smallrye / smallrye-graphql

Implementation for MicroProfile GraphQL
Apache License 2.0
160 stars 92 forks source link

Quarkus 3.10.1 Final native image building fails with `UnresolvedElementException: Discovered unresolved method during parsing` on GraphQL libraries #2123

Closed rhauch closed 4 months ago

rhauch commented 4 months ago

Summary

We're successfully using SmallRye GraphQL in our application:

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-graphql</artifactId>
      <version>3.10.1</version>
    </dependency>

and are able to run the application as a Java application w/ JRE. However, we are unable to build a native image due to this failure (or others very similar to this, see Details section below):

UnresolvedElementException: Discovered unresolved method during parsing: mdg.engine.proto.Reports$Trace$Details.getDefaultInstance(). This error is reported at image build time because class mdg.engine.proto.Reports$Trace is registered for linking at image build time by command line and command line.

Prior to adding the io.quarkus:quarkus-smallrye-graphql dependency, we are able to build and run the native application, so it seems like there is a problem with building a native application while using io.quarkus:quarkus-smallrye-graphql.

The mdg.engine.proto.Reports class is included in the com.apollographql.federation:federation-graphql-java-support:4.4.0 artifact, and the mdg.engine.proto code is generated from a protobuf file. So per the Quarkus Native Reference guide we tried adding this and the protobuf library as explicit dependencies.

Any suggestions or other workarounds I can try? I guess I would have thought this would have worked given that these are dependencies of io.quarkus:quarkus-smallrye-graphql.

FWIW, https://github.com/smallrye/smallrye-graphql/issues/1845 is a similar issue, though the problematic class was from the tracing service. This seems far more essential.

Details

When just including the

taken from this output:

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing mdg.engine.proto.Reports$Trace.writeTo(Reports.java:16675) 
Parsing context:
   at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:71)
   at com.apollographql.federation.graphqljava.tracing.FederatedTracingInstrumentation.instrumentExecutionResult(FederatedTracingInstrumentation.java:92)
   at graphql.execution.instrumentation.ChainedInstrumentation.lambda$instrumentExecutionResult$10(ChainedInstrumentation.java:356)
   at graphql.execution.instrumentation.ChainedInstrumentation$$Lambda/0x00000001664922f8.apply(Unknown Source)
   at graphql.execution.Async.eachSequentiallyImpl(Async.java:162)
   at graphql.execution.Async.eachSequentially(Async.java:151)
   at graphql.execution.instrumentation.ChainedInstrumentation.instrumentExecutionResult(ChainedInstrumentation.java:353)
   at graphql.GraphQL.lambda$handleAbortException$10(GraphQL.java:459)
   at graphql.GraphQL$$Lambda/0x0000000166457a18.apply(Unknown Source)
   at io.quarkus.jackson.runtime.JacksonSupport_fRqO007voVblR_BoQkAFpaGPHtI_Synthetic_Bean.createSynthetic(Unknown Source)
   at io.quarkus.jackson.runtime.JacksonSupport_fRqO007voVblR_BoQkAFpaGPHtI_Synthetic_Bean.doCreate(Unknown Source)
   at io.quarkus.jackson.runtime.JacksonSupport_fRqO007voVblR_BoQkAFpaGPHtI_Synthetic_Bean.create(Unknown Source)
   at io.quarkus.jackson.runtime.JacksonSupport_fRqO007voVblR_BoQkAFpaGPHtI_Synthetic_Bean.create(Unknown Source)
   at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)
   at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
   at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
   at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:32)
   at io.quarkus.arc.impl.ArcContainerImpl.beanManager(ArcContainerImpl.java:404)
   at io.quarkus.vertx.web.runtime.RouteHandler.<init>(RouteHandler.java:32)
   at io.confluent.cloud.dtx.outpost.restapi.resources.OAuthCallbackResource_RouteHandler_callback_b486d6c122450fd830a06fc5189a90526ac07926.<init>(Unknown Source)
   at com.oracle.svm.core.code.FactoryMethodHolder.OAuthCallbackResource_RouteHandler_callback_b486d6c122450fd830a06fc5189a90526ac07926_constructor_f05ae602c94a3b3d7b73412b639db725deb28b83(generated:0)
   at static root method.(Unknown Source)

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:149)
        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:153)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:111)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:114)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:620)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:491)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: com.oracle.graal.pointsto.util.AnalysisError: parsing had failed in another thread
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.shouldNotReachHere(AnalysisError.java:173)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:871)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:843)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:175)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1211)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1194)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1049)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1001)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:987)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:921)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:344)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:650)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:892)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:76)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:621)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
        ... 13 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: mdg.engine.proto.Reports$Trace$Details.getDefaultInstance(). This error is reported at image build time because class mdg.engine.proto.Reports$Trace is registered for linking at image build time by command line and command line.
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:544)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:471)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:368)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1698)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1677)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5441)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3431)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.iterateBytecodesForBlock(SharedGraphBuilderPhase.java:743)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3391)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3233)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1137)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.build(SharedGraphBuilderPhase.java:162)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1029)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:101)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:116)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:146)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:895)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:860)
        ... 28 more

The mdg.engine.proto.Reports class is included in the com.apollographql.federation:federation-graphql-java-support:4.4.0 artifact, and the mdg.engine.proto code is generated from a protobuf file.

The Quarkus Native Reference guide talks about Quarkus using GraalVM’s --link-at-build-time parameter, and how this doesn't handle optional dependencies with a few ways of trying to change dependencies from optional to required.

Adding this did not meaningfully change the failure:

    <dependency>
      <groupId>com.apollographql.federation</groupId>
      <artifactId>federation-graphql-java-support</artifactId>
      <version>${version.graphql-java-federation}</version>
      <optional>false</optional>
    </dependency>

with or without the <optional> element. Also adding this (with or without <optional>):

    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.19.6</version>
      <optional>false</optional>
    </dependency>

also had no meaningful effect, other than adding other unresolved methods in the mdg.engine.proto.Reports$Trace code. For example:

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing mdg.engine.proto.Reports$Trace.writeTo(Reports.java:16675) 
Parsing context:
   at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:71)
   at com.apollographql.federation.graphqljava.tracing.FederatedTracingInstrumentation.instrumentExecutionResult(FederatedTracingInstrumentation.java:92)
   at graphql.execution.instrumentation.ChainedInstrumentation.lambda$instrumentExecutionResult$10(ChainedInstrumentation.java:356)
   at graphql.execution.instrumentation.ChainedInstrumentation$$Lambda/0x0000000165528000.apply(Unknown Source)
   at graphql.execution.Async.eachSequentiallyImpl(Async.java:162)
   at graphql.execution.Async.eachSequentially(Async.java:151)
   at graphql.execution.instrumentation.ChainedInstrumentation.instrumentExecutionResult(ChainedInstrumentation.java:353)
   at graphql.GraphQL.lambda$handleAbortException$10(GraphQL.java:459)
   at graphql.GraphQL$$Lambda/0x0000000165527400.apply(Unknown Source)
   at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
   at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
   at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
   at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:667)
   at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160)
   at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
   at java.lang.reflect.Executable.sharedToString(Executable.java:123)
   at java.lang.reflect.Method.toString(Method.java:416)
   at root method.(Unknown Source)

or

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing mdg.engine.proto.Reports$Trace$QueryPlanNode$FetchNode.hashCode(Reports.java:11809) 
Parsing context:
   at root method.(Unknown Source)

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:149)
        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:153)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:111)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:114)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:620)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:491)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

or

Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: mdg.engine.proto.Reports$Trace$Details.hashCode(). This error is reported at image build time because class mdg.engine.proto.Reports$Trace is registered for linking at image build time by command line and command line.
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:544)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:471)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:368)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1740)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5439)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3431)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.iterateBytecodesForBlock(SharedGraphBuilderPhase.java:743)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3391)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3233)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1137)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.build(SharedGraphBuilderPhase.java:162)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1029)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:101)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:116)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:146)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:895)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:860)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:843)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:186)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:621)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:153)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:111)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:114)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:620)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:491)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool.externalHelpQuiesce(ForkJoinPool.java:2260)
        at java.base/java.util.concurrent.ForkJoinPool.helpQuiescePool(ForkJoinPool.java:2297)
        at java.base/java.util.concurrent.ForkJoinPool.awaitQuiescence(ForkJoinPool.java:3565)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.complete(CompletionExecutor.java:237)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis.doTypeflow(PointsToAnalysis.java:529)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis.finish(PointsToAnalysis.java:517)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:162)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:783)
        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:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing mdg.engine.proto.Reports$Trace$QueryPlanNode$FetchNode.hashCode(Reports.java:11809) 
Parsing context:
   at root method.(Unknown Source)
rhauch commented 4 months ago

It turns out the problem was that my application used a parent POM that had a slightly older version of com.google.protobuf:protobuf-java (3.19.6) in the dependencyManagement section than what is required by com.apollographql.federation:federation-graphql-java-support (3.25.2).

Since there were no other dependencies (including no direct dependency), the parent POM's version was used instead of the correct version. But this was difficult to discover, since Maven dependency analysis did not help highlight what was causing the earlier version to be used:

$ mvn dependency:tree -Dincludes=com.google.protobuf:protobuf-java
...
 \- io.quarkus:quarkus-smallrye-graphql:jar:3.10.1:compile
    \- io.smallrye:smallrye-graphql-cdi:jar:2.8.4:compile
       \- io.smallrye:smallrye-graphql:jar:2.8.4:compile
          \- com.apollographql.federation:federation-graphql-java-support:jar:4.4.0:compile
             \- com.google.protobuf:protobuf-java:jar:3.19.6:compile

As a result, when GraalVM is looking at dependencies, there must have been some com.google.protobuf:protobuf-java methods or types used by the generated protobuf code in com.apollographql.federation:federation-graphql-java-support:jar that must have changed or been added since version 3.19.6.

So an easy way to fix this is to add a direct dependency to my application to override the dependency :

    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.25.2</version>
    </dependency>

To be honest, I'm not sure what improvements to suggest, other than just keeping this issue available so that others running into the same error might find it and have some information for what workarounds to consider. So I'll add this information and close this issue.

If anyone can think of a change to existing resources/docs that might help, please reopen.