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

Additional queryAllDeclaredMethods entries break the native image build #5139

Closed
sdeleuze opened this issue Oct 4, 2022 · 3 comments
Closed
Assignees
Labels
bug native-image spring spring related issue

Comments

@sdeleuze
Copy link
Collaborator

sdeleuze commented Oct 4, 2022

In anticipation of behavior changes planned in GraalVM 23.0 related to metadata composability and described in https://github.com/graalvm/taming-build-time-initialization/blob/main/metadata-exceptions/Exceptions%20proposal.md, we have tried to add more "queryAllDeclaredMethods": true configuration as part of spring-projects/spring-framework#29246, but the outcome is that most builds are broken with this kind of error:

[7/7] Creating image...                                                                                  (0.0s @ 3.06GB)
Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: Registering type as reachable after analysis: AnalysisType<org.springframework.http.converter.HttpMessageConverter[], allocated: 0, inHeap: 0, reachable: 0>
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:682)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
Caused by: com.oracle.svm.core.util.VMError$HostedError: Registering type as reachable after analysis: AnalysisType<org.springframework.http.converter.HttpMessageConverter[], allocated: 0, inHeap: 0, reachable: 0>
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.registerAsReachable(AnalysisConstantReflectionProvider.java:332)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.HostedDynamicHubFeature.replace(HostedDynamicHubFeature.java:53)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:583)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addArrayElements(NativeImageHeap.java:576)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObjectToImageHeap(NativeImageHeap.java:473)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObject(NativeImageHeap.java:295)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:598)
------------------------------------------------------------------------------------------------------------------------
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:198)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:664)
        ... 4 more

To reproduce, checkout the after-analysis-error branch of my Spring AOT smoke test fork and run ./gradlew webmvc-tomcat:nativeCompile.

To identify the additional entries you can do a diff between META-INF/native-image/spring-aot-smoke-tests/webmvc-tomcat/reflect-config.json (the version without the additional "queryAllDeclaredMethods": true entries which works fine) and resources/META-INF/native-image/reflect-config.json (the version with the "queryAllDeclaredMethods": true which fails).

The expected behavior is that additional "queryAllDeclaredMethods": true entries should not break the build.

cc @bclozel @vjovanov

@sdeleuze sdeleuze added bug native-image spring spring related issue labels Oct 4, 2022
@sdeleuze
Copy link
Collaborator Author

sdeleuze commented Oct 4, 2022

I can also reproduce a similar issue on the repro project of #5098:

Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: Registering type as reachable after analysis: AnalysisType<com.fasterxml.jackson.databind.JsonSerializer[], allocated: 0, inHeap: 0, reachable: 0>

@loicottet
Copy link
Member

This issue should have been fixed by e4b3312. Can you please confirm this is the case?

@sdeleuze
Copy link
Collaborator Author

I confirm it works my local build of https://github.com/oracle/graal/tree/release/graal-vm/22.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug native-image spring spring related issue
Projects
None yet
Development

No branches or pull requests

3 participants