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 image build fails with "New Method or Constructor found as reachable after static analysis" #30429

Closed
korkutkose opened this issue May 5, 2023 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue theme: aot An issue related to Ahead-of-time processing

Comments

@korkutkose
Copy link

korkutkose commented May 5, 2023

Hi everyone,

While I was working on our monthly spring boot version upgrade process, I hit an error which is saying "New Method or Constructor found as reachable after static analysis". When I downgrade the boot version to 3.0.5 everything starts to work properly again. This might be related with graalvm itself or spring cloud stream too. I just could not be sure about it.
When I track the class, I found out that it's coming from one of the spring-cloud-stream transitive dependencies.

Please redirect me if this is not the right place.
Cheers.

Working Set:

<spring-cloud.version>2022.0.1</spring-cloud.version>
<spring.boot.version>3.0.5</spring.boot.version>

Failing Set:

<spring-cloud.version>2022.0.2</spring-cloud.version> -> also fails with 2022.0.1 so that might not be related with cloud stream?
<spring.boot.version>3.0.6</spring.boot.version>
╰─ java -version                                                                                                                                                                           ─╯
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13, mixed mode, sharing)

Error message:

  38,771 (91.67%) of 42,295 classes reachable
  68,324 (70.54%) of 96,863 fields reachable
 179,078 (62.85%) of 284,946 methods reachable
   2,569 classes, 1,516 fields, and 20,809 methods registered for reflection
      68 classes,    75 fields, and    56 methods registered for JNI access
       5 native libraries: -framework CoreServices, -framework Foundation, dl, pthread, z
[3/7] Building universe...                                                                              (26.3s @ 6.38GB)
[4/7] Parsing methods...      [****]                                                                    (20.9s @ 2.98GB)
[5/7] Inlining methods...     [***]                                                                      (7.2s @ 4.67GB)
[6/7] Compiling methods...    [********]                                                                (67.3s @ 4.26GB)
[7/7] Creating image...
                                                                                  (0.0s @ 3.31GB)
Fatal error: com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public java.lang.Object org.springframework.integration.config.ConverterRegistrar$IntegrationConverterRegistration.converter()
	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:696)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public java.lang.Object org.springframework.integration.config.ConverterRegistrar$IntegrationConverterRegistration.converter()
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.getOrCreateAccessor(ReflectionFeature.java:121)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.target.ExecutableAccessorComputer.transform(ExecutableAccessorComputer.java:43)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.computeValue(ComputedValueField.java:343)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.substitute.ComputedValueField.readValue(ComputedValueField.java:313)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.meta.ReadableJavaField.readFieldValue(ReadableJavaField.java:38)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readValue(AnalysisConstantReflectionProvider.java:97)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedField.readValue(HostedField.java:161)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addObjectToImageHeap(NativeImageHeap.java:439)
	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:678)
	... 4 more```
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 5, 2023
@snicoll snicoll transferred this issue from spring-projects/spring-boot May 5, 2023
@snicoll
Copy link
Member

snicoll commented May 5, 2023

Likely a duplicate of #30407

@snicoll snicoll changed the title Spring Native Build with Boot 3.0.6 Fails with New Method or Constructor found as reachable after static analysis Native image build fails with "New Method or Constructor found as reachable after static analysis" May 5, 2023
@sdeleuze sdeleuze self-assigned this May 5, 2023
@sdeleuze sdeleuze added the theme: aot An issue related to Ahead-of-time processing label May 5, 2023
@sdeleuze sdeleuze added this to the 6.0.9 milestone May 5, 2023
@sdeleuze sdeleuze added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 5, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented May 5, 2023

I can indeed reproduce just by adding Spring Cloud Stream dependency.

@sdeleuze sdeleuze removed this from the 6.0.9 milestone May 5, 2023
@sdeleuze sdeleuze added status: duplicate A duplicate of another issue and removed type: regression A bug that is also a regression labels May 5, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented May 5, 2023

This is a duplicate of #30383.

@sdeleuze sdeleuze closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue theme: aot An issue related to Ahead-of-time processing
Projects
None yet
Development

No branches or pull requests

4 participants