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 compile failed ( java.lang.StackOverflowError) when field type is enum. #13671

Closed
imgoby opened this issue Jan 17, 2024 · 5 comments
Labels
type/bug Bugs to being fixed

Comments

@imgoby
Copy link

imgoby commented Jan 17, 2024

<dubbo.version>3.3.0-beta.1</dubbo.version>


public enum MyType {
    OK,
    FAILED
}

public class DemoServiceImpl implements DemoService {

    @Override
    public String sayHello(MyType type) {
        return "Hello " + type.name();
    }
}

public interface DemoService {
    String sayHello(MyType type);
}

if field type is enum ,it causes this exception:

2024-01-17T10:14:48.926+08:00  INFO 18606 --- [           main] o.s.c.a.ConfigurationClassPostProcessor  : Cannot enhance @Configuration bean definition 'org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2024-01-17T10:14:49.048+08:00  INFO 18606 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=fe7cc2c4-0c4b-303e-94cb-821e2db5fcad
Exception in thread "main" java.lang.StackOverflowError
	at java.base/java.util.HashMap.hash(HashMap.java:338)
	at java.base/java.util.HashMap.put(HashMap.java:610)
	at java.base/java.util.HashSet.add(HashSet.java:221)
	at org.springframework.aot.hint.SerializationHints.registerType(SerializationHints.java:64)
	at org.springframework.aot.hint.SerializationHints.registerType(SerializationHints.java:75)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:48)
	at org.apache.dubbo.config.spring6.utils.AotUtils.lambda$registerSerializationType$2(AotUtils.java:50)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:50)
	at org.apache.dubbo.config.spring6.utils.AotUtils.lambda$registerSerializationType$2(AotUtils.java:50)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:50)
	at org.apache.dubbo.config.spring6.utils.AotUtils.lambda$registerSerializationType$2(AotUtils.java:50)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:50)
	at org.apache.dubbo.config.spring6.utils.AotUtils.lambda$registerSerializationType$2(AotUtils.java:50)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at org.apache.dubbo.config.spring6.utils.AotUtils.registerSerializationType(AotUtils.java:50)

my demo project is here:
https://github.com/imgoby/spring-cloud-alibaba-dubbo-native/tree/main/dubbo-samples-spring-boot-provider

@imgoby imgoby added the type/need-triage Need maintainers to triage label Jan 17, 2024
@imgoby
Copy link
Author

imgoby commented Jan 17, 2024

@CrazyHZM

@imgoby
Copy link
Author

imgoby commented Jan 18, 2024

image
This judgment seems to be acceptable

@CrazyHZM
Copy link
Member

@imgoby
This does not seem to be supported by spring itself.

@imgoby
Copy link
Author

imgoby commented Jan 18, 2024

this code file is under dubbo project.
org.apache.dubbo.config.spring6.utils.AotUtils

it is dubbo's code bug. not spring.

@CrazyHZM
Copy link
Member

@imgoby
You are right. It will be fixed in the next version.

@CrazyHZM CrazyHZM added type/bug Bugs to being fixed and removed type/need-triage Need maintainers to triage labels Jan 18, 2024
@CrazyHZM CrazyHZM modified the milestone: 3.2.11 Jan 18, 2024
@CrazyHZM CrazyHZM linked a pull request Jan 18, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants