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 builds fail unless narayana-jta is also present #108

Closed
gemmellr opened this issue Apr 24, 2023 · 2 comments
Closed

native builds fail unless narayana-jta is also present #108

gemmellr opened this issue Apr 24, 2023 · 2 comments

Comments

@gemmellr
Copy link
Contributor

The quarkus-pooled-jms deployment module has an optional dependency on quarkus-narayana-jta-deployment (with the XA support for the pooling being disabled by default), however it appears the extension really requires some bits from it be present. A native application build using quarkus-pooled-jms, not doing any XA at all, fails without it due to class org.jboss.tm.XAResourceRecoveryRegistry not being found:

Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.jboss.tm.XAResourceRecoveryRegistry. This error is reported at image build time because class io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper is registered for linking at image build time by command line

(For more complete stack, see later)

This was noticed simple adding the quarkus-pooled-jms 2.0.0 dependency to an application using quarkus-qpid-jms 2.0.0, building with Mandrel 22.3.2.0 . Not even actually using the pool yet. Adding the dependency on quarkus-narayana-jta-deployment to the application itself, even though it wasnt doing any XA, was required to get the build to work with quarkus-pooled-jms in place.

More complete stacks:

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper.wrapConnectionFactory(jakarta.jms.ConnectionFactory) 
Parsing context:
   at io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper.wrapConnectionFactory(PooledJmsWrapper.java:24)
   at io.quarkiverse.messaginghub.pooled.jms.PooledJmsRecorder.lambda$getWrapper$0(PooledJmsRecorder.java:20)
   at io.quarkiverse.messaginghub.pooled.jms.PooledJmsRecorder$$Lambda$965/0x00000007c132e8a8.apply(Unknown Source)
   at io.smallrye.context.SmallRyeManagedExecutor_37cd00d79f6817c9ac6f4041646d6c5b8c1d4c69_Synthetic_Bean.createSynthetic(Unknown Source)
   at io.smallrye.context.SmallRyeManagedExecutor_37cd00d79f6817c9ac6f4041646d6c5b8c1d4c69_Synthetic_Bean.doCreate(Unknown Source)
   at io.smallrye.context.SmallRyeManagedExecutor_37cd00d79f6817c9ac6f4041646d6c5b8c1d4c69_Synthetic_Bean.create(Unknown Source)
   at io.smallrye.context.SmallRyeManagedExecutor_37cd00d79f6817c9ac6f4041646d6c5b8c1d4c69_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 org.acme.jms.PriceProducer_Observer_onStart_66a261b0dd2a8c542d0c570163f0a57eedc14ef7.notify(Unknown Source)
   at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:346)
   at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:328)
   at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:263)
   at io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:397)
   at io.quarkus.arc.Arc.shutdown(Arc.java:72)
   at io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:53)
   at java.lang.Shutdown.runHooks(Shutdown.java:130)
   at java.lang.Shutdown.shutdown(Shutdown.java:185)
   at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:154)

	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: org.jboss.tm.XAResourceRecoveryRegistry. This error is reported at image build time because class io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper is registered for linking at image build time by command line
	at parsing io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper.getXAConnectionFactory(PooledJmsWrapper.java:44)
	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: org.jboss.tm.XAResourceRecoveryRegistry. This error is reported at image build time because class io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper 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.handleUnresolvedLoadConstant(SharedGraphBuilderPhase.java:259)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genLoadConstant(BytecodeParser.java:3945)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5124)
------------------------------------------------------------------------------------------------------------------------	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
	... 38 more
@zhfeng
Copy link
Contributor

zhfeng commented Apr 25, 2023

I have to add org.jboss.narayana.jta:narayana-jta and org.jboss:jboss-transaction-spi right now. This could be fixed by

zhfeng added a commit to zhfeng/quarkus-pooled-jms that referenced this issue Apr 25, 2023
@zhfeng zhfeng closed this as completed in 8b97af8 Apr 25, 2023
zhfeng added a commit to zhfeng/quarkus-pooled-jms that referenced this issue Apr 25, 2023
zhfeng added a commit that referenced this issue Apr 25, 2023
gemmellr added a commit to gemmellr/quarkus-pooled-jms that referenced this issue Apr 25, 2023
…a and org.jboss:jboss-transaction-spi (quarkiverse#111)"

This reverts commit 8b97af8.
gemmellr added a commit to gemmellr/quarkus-pooled-jms that referenced this issue Apr 25, 2023
…a and org.jboss:jboss-transaction-spi (quarkiverse#111)"

This reverts commit 8b97af8.
@gemmellr
Copy link
Contributor Author

Its not clear to me that graal issue actually applies since the transaction settings are runtime configurable. The wrapper class is always loaded, and so the XA related code within it and thus all the XA related classes would still be considered reachable at runtime because it really is.

It doesnt seem like that graal issue is being worked on any time soon regardless, and having the XA bits be required and present even when not being used feels a bit icky.

An alternative solution would be to indirect the use of the transaction related classes such that it is isolated to a support class that is normally used, but we can add substitutions to disable it from being reachable in cases its known the transaction classes arent present during the native build, meaning they then arent actually required when not actually being used.

I've taken a shot at that in #113

zhfeng pushed a commit that referenced this issue Apr 26, 2023
* allow manually running the tests, useful for branches

* Revert "Fix #108 to add org.jboss.narayana.jta:narayana-jta and org.jboss:jboss-transaction-spi (#111)"

This reverts commit 8b97af8.

* indirect transaction bits, enable native builds when XA RecoveryRegistry etc classes/deps are not present or being used
zhfeng pushed a commit to zhfeng/quarkus-pooled-jms that referenced this issue Apr 26, 2023
…e#113)

* allow manually running the tests, useful for branches

* Revert "Fix quarkiverse#108 to add org.jboss.narayana.jta:narayana-jta and org.jboss:jboss-transaction-spi (quarkiverse#111)"

This reverts commit 8b97af8.

* indirect transaction bits, enable native builds when XA RecoveryRegistry etc classes/deps are not present or being used
zhfeng added a commit that referenced this issue Apr 26, 2023
* allow manually running the tests, useful for branches

* Revert "Fix #108 to add org.jboss.narayana.jta:narayana-jta and org.jboss:jboss-transaction-spi (#111)"

This reverts commit 8b97af8.

* indirect transaction bits, enable native builds when XA RecoveryRegistry etc classes/deps are not present or being used

Co-authored-by: Robbie Gemmell <robbie@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants