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 build failure (Mongo Client) after upgrade to Quarkus 3.0.2-Final #33250

Closed
freddieFishCake opened this issue May 10, 2023 · 9 comments
Closed
Labels
area/mandrel area/native-image kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.

Comments

@freddieFishCake
Copy link

freddieFishCake commented May 10, 2023

Describe the bug

Native build fails with:

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing io.quarkus.mongodb.runtime.MongoClients.createMongoCredential(io.quarkus.mongodb.runtime.MongoClientConfig) 
Parsing context:
   at io.quarkus.mongodb.runtime.MongoClients.createMongoCredential(MongoClients.java:388)
   at io.quarkus.mongodb.runtime.MongoClients.createMongoConfiguration(MongoClients.java:281)
   at io.quarkus.mongodb.runtime.MongoClients.createMongoClient(MongoClients.java:122)
   at io.quarkus.mongodb.runtime.MongoClientRecorder.lambda$mongoClientSupplier$0(MongoClientRecorder.java:66)
   at io.quarkus.mongodb.runtime.MongoClientRecorder$$Lambda$1087/0x00000007c1e93418.apply(Unknown Source)
   at io.netty.channel.EventLoopGroup_92f1c3a38cd361eb7ad27a9fe6324edba5748ae1_Synthetic_Bean.createSynthetic(Unknown Source)
   at io.netty.channel.EventLoopGroup_92f1c3a38cd361eb7ad27a9fe6324edba5748ae1_Synthetic_Bean.doCreate(Unknown Source)
   at io.netty.channel.EventLoopGroup_92f1c3a38cd361eb7ad27a9fe6324edba5748ae1_Synthetic_Bean.create(Unknown Source)
   at io.netty.channel.EventLoopGroup_92f1c3a38cd361eb7ad27a9fe6324edba5748ae1_Synthetic_Bean.create(Unknown Source)
   at io.quarkus.arc.impl.RequestContext.getIfActive(RequestContext.java:74)
   at io.quarkus.arc.impl.RequestContext.get(RequestContext.java:82)
   at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:21)
   at net.vaisala.sampo.services.measurementaggregation.common.MeasurementTypeRepository_ClientProxy.arc$delegate(Unknown Source)
   at net.vaisala.sampo.services.measurementaggregation.common.MeasurementTypeRepository_ClientProxy.toString(Unknown Source)
   at java.util.Objects.toString(Objects.java:164)
   at java.lang.Throwable.initCause(Throwable.java:463)
   at java.lang.AssertionError.<init>(AssertionError.java:77)
   at com.oracle.svm.core.snippets.ImplicitExceptions.createAssertionErrorObject(ImplicitExceptions.java:222)

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:153)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:104)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:83)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraph(MethodTypeFlow.java:65)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultSpecialInvokeTypeFlow.onObservedUpdate(DefaultSpecialInvokeTypeFlow.java:61)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:562)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:488)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.quarkus.credentials.runtime.CredentialsProviderFinder. This error is reported at image build time because class io.quarkus.mongodb.runtime.MongoClients is registered for linking at image build time by command line
        at parsing io.quarkus.mongodb.runtime.MongoClients.determineUserNamePassword(MongoClients.java:438)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        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:446)
        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:135)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:685)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysis.java:180)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1162)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1145)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1003)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:957)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:817)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysis.java:240)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:548)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:833)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:98)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:179)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:349)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:93)
        ... 13 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.quarkus.credentials.runtime.CredentialsProviderFinder. This error is reported at image build time because class io.quarkus.mongodb.runtime.MongoClients is registered for linking at image build time by command line
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:333)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedType(SharedGraphBuilderPhase.java:288)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:316)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:279)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1676)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1651)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5288)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
        ... 38 more

Expected behavior

The build should complete.

Actual behavior

The build fails.

How to Reproduce?

The build passes with previous versions of Quarkus, up to:
<quarkus.version>2.15.1.Final</quarkus.version>
and quarkus-mandrel up to:
<quarkus.native.builder-image>quay.io/quarkus/ubi-quarkus-mandrel:22.2-java17</quarkus.native.builder-image>

When building with Quarkus

Output of uname -a or ver

Linux pjl-ThinkPad-P1-Gen-3 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 17.0.6+10-Ubuntu-0ubuntu122.04, mixed mode, sharing)

GraalVM version (if different from Java)

Version info: 'GraalVM 22.3.0.1-Final Java 17 Mandrel Distribution'

Quarkus version or git rev

3.0.2-Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)

Additional information

No response

@freddieFishCake freddieFishCake added the kind/bug Something isn't working label May 10, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented May 10, 2023

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel)

@freddieFishCake freddieFishCake changed the title Native build failure after upgrade to Quarkus 3.0.2-Final Native build failure (Mongo Client) after upgrade to Quarkus 3.0.2-Final May 10, 2023
@gsmet
Copy link
Member

gsmet commented May 10, 2023

Are you sure your dependency tree is consistent i.e. all the Quarkus dependencies are 3.0.2.Final including the Quarkus Maven plugin?
If so, I think we will need a reproducer.

@freddieFishCake
Copy link
Author

Are you sure your dependency tree is consistent i.e. all the Quarkus dependencies are 3.0.2.Final including the Quarkus Maven plugin? If so, I think we will need a reproducer.

<plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus.version}</version> <executions> <execution> <goals> <goal>build</goal> </goals> </execution> </executions> </plugin>
I will try to make a small reproducer...

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label May 10, 2023
@freddieFishCake
Copy link
Author

I'm no sure why but adding a maven dependency to file-vault seems to help:

<!-- File vault needed since Quarkus 3.x for native builds --> <dependency> <groupId>io.quarkiverse.file-vault</groupId> <artifactId>quarkus-file-vault</artifactId> <version>2.0.0</version> </dependency>

GraalVM Native Image: Generating 'measurement-consumer-0.0.1-SNAPSHOT-runner' (executable)... ... Finished generating 'measurement-consumer-0.0.1-SNAPSHOT-runner' in 2m 16s

@gsmet
Copy link
Member

gsmet commented May 15, 2023

Please provide a reproducer. We won't be able to understand what's going on otherwise. Thanks.

@freddieFishCake
Copy link
Author

freddieFishCake commented May 15, 2023 via email

@freddieFishCake
Copy link
Author

Sorry for the delay.
I have tried to create a reproducer by taking our large multi-module build and extracting the module that failed, together with all of it's dependencies into a stand-alone project, then stubbing out parts that are not obviously relevant (e.g. AWS DynamoDB stuff).
However, the resulting reproducer single module project builds just fine with Quarkus 3.0.2.Final and -Pnative - without the need to add a dependency to quarkus-file-vault.

@geoand
Copy link
Contributor

geoand commented Jun 15, 2023

I am going to close this as we don't have a reproducer. If you are at some point able to provide one, please attach it and we will take a look

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2023
@BastianSperrhacke-Otto
Copy link

BastianSperrhacke-Otto commented Sep 19, 2023

@freddieFishCake @gsmet @geoand I had also the problem described here. I solved it by adding this related dependency containing the given/missing class to the pom.xml of the module that comes with mongodb dependency:

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-credentials</artifactId>
            <scope>runtime</scope>
        </dependency>

It seems, that this dependency is missing in the dependency tree of mongodb quarkus somewhere since quarkus v3 (we upgraded from 2.16).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mandrel area/native-image kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

No branches or pull requests

5 participants