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

fails to build in graalvm 21.1 #251

Closed
argenstijn opened this issue Jun 18, 2021 · 6 comments · Fixed by #253
Closed

fails to build in graalvm 21.1 #251

argenstijn opened this issue Jun 18, 2021 · 6 comments · Fixed by #253

Comments

@argenstijn
Copy link

The build succeeds in 21.0.X version but fails to build in 21.1.

This is the error:

CarClaimsExchanger-1.0-b6823974-runner:312] analysis: 196,866.07 ms, 5.70 GB
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace:
at parsing org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue(AttachmentUtil.java:255)
Call path from entry point to org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue():
at org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue(AttachmentUtil.java:255)
at org.apache.cxf.attachment.AttachmentSerializer.writeProlog(AttachmentSerializer.java:82)
at org.apache.cxf.interceptor.AttachmentOutInterceptor.handleMessage(AttachmentOutInterceptor.java:86)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1201)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
com.oracle.svm.core.util.UserError$UserException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace:
at parsing org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue(AttachmentUtil.java:255)
Call path from entry point to org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue():
at org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue(AttachmentUtil.java:255)
at org.apache.cxf.attachment.AttachmentSerializer.writeProlog(AttachmentSerializer.java:82)
at org.apache.cxf.interceptor.AttachmentOutInterceptor.handleMessage(AttachmentOutInterceptor.java:86)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1201)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:798)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace:
at parsing org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue(AttachmentUtil.java:255)
Call path from entry point to org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue():
at org.apache.cxf.attachment.AttachmentUtil.getUniqueBoundaryValue(AttachmentUtil.java:255)
at org.apache.cxf.attachment.AttachmentSerializer.writeProlog(AttachmentSerializer.java:82)
at org.apache.cxf.interceptor.AttachmentOutInterceptor.handleMessage(AttachmentOutInterceptor.java:86)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1201)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:795)
... 8 more
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=. Or you can write your own initialization methods and call them explicitly from your main entry point.
at com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.error(DisallowedImageHeapObjectFeature.java:163)
at com.oracle.svm.core.image.DisallowedImageHeapObjects.check(DisallowedImageHeapObjects.java:65)
at com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.replacer(DisallowedImageHeapObjectFeature.java:139)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:565)
at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:213)
at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.interceptValue(AnalysisConstantReflectionProvider.java:184)
at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readValue(AnalysisConstantReflectionProvider.java:98)
at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readFieldValue(AnalysisConstantReflectionProvider.java:77)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.util.ConstantFoldUtil$1.readValue(ConstantFoldUtil.java:51)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.common.spi.JavaConstantFieldProvider.readConstantField(JavaConstantFieldProvider.java:84)
at com.oracle.svm.hosted.ameta.AnalysisConstantFieldProvider.readConstantField(AnalysisConstantFieldProvider.java:70)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.util.ConstantFoldUtil.tryConstantFold(ConstantFoldUtil.java:47)
at com.oracle.svm.hosted.phases.ConstantFoldLoadFieldPlugin.tryConstantFold(ConstantFoldLoadFieldPlugin.java:61)
at com.oracle.svm.hosted.phases.ConstantFoldLoadFieldPlugin.handleLoadStaticField(ConstantFoldLoadFieldPlugin.java:57)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genGetStatic(BytecodeParser.java:4972)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genGetStatic(BytecodeParser.java:4939)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5442)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3451)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3258)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1125)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1019)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:76)
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:212)
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 com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:113)
at com.oracle.svm.hosted.SVMHost.parseBytecode(SVMHost.java:647)
at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:592)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:163)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:304)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:313)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:302)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:420)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:547)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
... 5 more
Error: Image build request failed with exit status 1

@shumonsharif
Copy link
Contributor

@argenstijn This is behaving as expected; we are not yet using a version of Quarkus that supports 21.1. I anticipate this issue won't exist once we switch to the Quarkus 2.0 stable releases. You can refer to the following for more details:

https://github.com/quarkusio/quarkus/issues?q=is%3Aissue+Detected+an+instance+of+Random%2FSplittableRandom+class+in+the+image+heap+is%3Aclosed

Closing this issue for now, but please let us know if you have a need to have it reopened.

@dufoli dufoli reopened this Jun 24, 2021
@dufoli
Copy link
Contributor

dufoli commented Jun 24, 2021

I reopen it because quarkus is released and we have to handle it:
#253

@dufoli dufoli linked a pull request Jun 24, 2021 that will close this issue
@shumonsharif
Copy link
Contributor

@dufoli This was a bit painful to figure out ... :) but I think it should give us what we need to fix this issue.

When I add the following to integration-tests/pom.xml

<quarkus.native.additional-build-args>-H:IncludeResourceBundles=org.apache.cxf.interceptor.Messages,--initialize-at-run-time=org.apache.cxf.endpoint.ClientImpl\,org.apache.cxf.phase.PhaseInterceptorChain\,org.apache.cxf.interceptor.AttachmentOutInterceptor\,org.apache.cxf.attachment.AttachmentSerializer\,org.apache.cxf.attachment.AttachmentUtil\,org.apache.cxf.service.factory.AbstractServiceFactoryBean\,org.apache.cxf.interceptor.OneWayProcessorInterceptor\,org.apache.cxf.interceptor.OneWayProcessorInterceptor$1\,org.apache.cxf.ws.addressing.impl.InternalContextUtils\,org.apache.cxf.ws.addressing.impl.InternalContextUtils$1\,org.apache.cxf.transport.http.HTTPConduit\,org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream\,org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1</quarkus.native.additional-build-args>

native build works fine with GraalVM 21.1, and everything passes.

However, when I add the same classes to QuarkusCxfProcessor using RuntimeInitializedClassBuildItem it seems to have zero impact. Tried it a few different ways, but couldn't get it to work. Let me know if you have any insights, not sure if we're doing something wrong, or if it's a Quarkus issue.

@dufoli
Copy link
Contributor

dufoli commented Jun 24, 2021

lol I was doing the same stuff with RuntimeInitializedClassBuildItem .
can you push on the branch the commit on RuntimeInitializedClassBuildItem
I will check later

@shumonsharif
Copy link
Contributor

@dufoli was just about to commit the changes, but just realized you did the same commit 5 mins ago ... let me know if i can help in any way; i have a little time before my workday starts!

@dufoli
Copy link
Contributor

dufoli commented Jun 25, 2021

done and working :-)

@ppalaga ppalaga added this to the no fix/won't fix milestone Nov 30, 2022
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

Successfully merging a pull request may close this issue.

4 participants