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

Setting spring.aot.enabled=true causes stack overflow #30684

Open
yozaner1324 opened this issue Jun 16, 2023 · 3 comments
Open

Setting spring.aot.enabled=true causes stack overflow #30684

yozaner1324 opened this issue Jun 16, 2023 · 3 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug

Comments

@yozaner1324
Copy link

I have a basic Spring Boot app using web and GemFire. When I run it with aot enabled, like this: java -Dspring.aot.enabled=true -jar build/libs/spring-native-experiment-1.0-SNAPSHOT.jar, it breaks, but when I disabled aot, like this: java -Dspring.aot.enabled=false -jar build/libs/spring-native-experiment-1.0-SNAPSHOT.jar, it runs as expected.

Spring Boot 3.0.7
GraalVM 17.0.7+8.1
MacOs 13.4 on an M1 Mac

Stack-trace:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gemfireClusterSchemaObjectInitializer': Unsatisfied dependency expressed through method 'gemfireClusterSchemaObjectInitializer' parameter 1: Error creating bean with name 'gemfireCache': Instantiation of supplied bean failed
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:315) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:258) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:198) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.9.jar!/:6.0.9]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:941) ~[spring-context-6.0.9.jar!/:6.0.9]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608) ~[spring-context-6.0.9.jar!/:6.0.9]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.7.jar!/:3.0.7]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.7.jar!/:3.0.7]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.7.jar!/:3.0.7]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.7.jar!/:3.0.7]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.7.jar!/:3.0.7]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.7.jar!/:3.0.7]
        at org.example.MyApplication.main(MyApplication.java:28) ~[classes!/:1.0-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[spring-native-experiment-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) ~[spring-native-experiment-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[spring-native-experiment-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[spring-native-experiment-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]

The full stack trace is attached as a file because it was too long.
Code to reproduce: https://github.com/yozaner1324/spring-native-experiment

Steps to reproduce:

  1. ./gradlew bootJar
  2. java -Dspring.aot.enabled=true -jar build/libs/spring-native-experiment-1.0-SNAPSHOT.jar

stackoverflow.txt

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 16, 2023
@snicoll
Copy link
Member

snicoll commented Jun 17, 2023

Thanks for the report and for providing a sample. However, this doesn't build not for me:

> Could not get unknown property 'gemfireRepoUsername' for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Jun 19, 2023
@spring-projects-issues

This comment was marked as outdated.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Jun 26, 2023
@snicoll snicoll removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Jun 26, 2023
@snicoll
Copy link
Member

snicoll commented Jun 26, 2023

I’ve been able to reproduce with additional instructions from the OP. I suspect that the CGLIB proxy and reentrant calls are leading to this. It isn’t a cycle per se as it stops before ending up in a StackOverflow.

@snicoll snicoll added the theme: aot An issue related to Ahead-of-time processing label Oct 8, 2023
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 27, 2023
@snicoll snicoll added this to the 6.x Backlog milestone Dec 27, 2023
@jhoeller jhoeller added the in: core Issues in core modules (aop, beans, core, context, expression) label Dec 29, 2023
@jhoeller jhoeller modified the milestones: 6.x Backlog, General Backlog Oct 1, 2024
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) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants