Skip to content

Additional queryAllDeclaredMethods entries break the native image build #5139

@sdeleuze

Description

@sdeleuze

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

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions