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

Add Netty substitution that addresses Camel Quarkus issue #6597

Merged
merged 2 commits into from
Jan 17, 2020

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Jan 17, 2020

Addresses the issue in Camel Quarkus with GraalVM 19.3.1 (it only appears in that version) where the native image generation fails with:

[camel-quarkus-integration-test-http-1.1.0-SNAPSHOT-runner:31640]     analysis: 480,218.87 ms
Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.oracle.svm.reflect.ClassLoader_defineClass_c6c343b4d6dc22ca64eb2d8503b13ac9c340dcb3.invoke(java.lang.Object, java.lang.Object[])
Parsing context:
        parsing java.lang.reflect.Method.invoke(Method.java:498)
        parsing org.apache.camel.support.ObjectHelper.invokeMethod(ObjectHelper.java:182)
        parsing org.apache.camel.main.BaseMainSupport.loadConfigurations(BaseMainSupport.java:467)
        parsing org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:522)
        parsing org.apache.camel.quarkus.core.CamelMain.postProcessCamelContext(CamelMain.java:59)
        parsing org.apache.camel.quarkus.core.CamelMain.doStart(CamelMain.java:49)
        parsing org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:117)
        parsing org.apache.camel.quarkus.core.CamelMainRecorder.start(CamelMainRecorder.java:92)
        parsing io.quarkus.deployment.steps.Main$start76.deploy_0(Main$start76.zig:78)
        parsing io.quarkus.deployment.steps.Main$start76.deploy(Main$start76.zig:97)
        parsing io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:261)
        parsing io.quarkus.runtime.Application.start(Application.java:87)
        parsing io.quarkus.runtime.Application.run(Application.java:210)
        parsing io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:41)
        parsing com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        parsing com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        parsing com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

        at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:327)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:300)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
        at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:191)
        at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:343)
        at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:385)
        at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:511)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:171)
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:183)
        at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
        at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:397)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:377)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:75)
        at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
        at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
        at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:39)
        at com.oracle.svm.reflect.hosted.ReflectionSubstitutionType$ReflectiveInvokeMethod.buildGraph(ReflectionSubstitutionType.java:511)
        at com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:319)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:185)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:340)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)

Both the root cause tracking and the substitution were provided by @dmlloyd (hence the author of the commit)

@geoand
Copy link
Contributor Author

geoand commented Jan 17, 2020

cc @lburgazzoli

@lburgazzoli
Copy link
Contributor

we'll retest the quarkus side once merged

@geoand
Copy link
Contributor Author

geoand commented Jan 17, 2020

I am also linking the GraalVM issue that was opened to make tracking down such issues easier the future: oracle/graal#2076

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geoand you're my hero :).

I added a very small comment, otherwise let's merge that one ASAP.

@geoand
Copy link
Contributor Author

geoand commented Jan 17, 2020

@gsmet I committed your suggestion, thanks for spotting the mistake!

@geoand
Copy link
Contributor Author

geoand commented Jan 17, 2020

The PR needs to be rebased onto master because in the meantime a PR was merged changing the FT stuff

@geoand geoand added this to the 1.2.0 milestone Jan 17, 2020
@geoand geoand requested a review from gsmet January 17, 2020 10:27
@geoand
Copy link
Contributor Author

geoand commented Jan 17, 2020

#6594 also tested this with GraalVM 19.3.1 (and so did I locally)

@geoand
Copy link
Contributor Author

geoand commented Jan 17, 2020

The CI failure is a flaky test that has nothing to do with this PR (and is being tracked by @sberyozkin). I'm gonna merge once the other tests complete

@geoand geoand merged commit 62c47bb into quarkusio:master Jan 17, 2020
@geoand geoand deleted the camel-quarkus branch January 17, 2020 12:47
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 this pull request may close these issues.

4 participants