springwolf / springwolf-core

Automated documentation for event-driven applications built with Spring Boot
https://www.springwolf.dev
Apache License 2.0
248 stars 70 forks source link

java.lang.StackOverflowError: null in 1.4.0 release #830

Closed warorc closed 3 months ago

warorc commented 3 months ago

Describe the bug During docs generation I've got error:

java.lang.StackOverflowError: null
    at java.base/java.lang.String.contains(String.java:2858) ~[na:na]
    at io.github.springwolf.asyncapi.v3.model.channel.message.MessageReference.extractRefName(MessageReference.java:54) ~[springwolf-asyncapi-1.4.0.jar:na]
    at io.github.springwolf.core.asyncapi.components.postprocessors.AvroSchemaPostProcessor.removeAvroProperties(AvroSchemaPostProcessor.java:31) ~[springwolf-core-1.4.0.jar:na]
    at io.github.springwolf.core.asyncapi.components.postprocessors.AvroSchemaPostProcessor.lambda$removeAvroProperties$0(AvroSchemaPostProcessor.java:49) ~[springwolf-core-1.4.0.jar:na]
    at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[na:na] 

Seems this part:

private void removeAvroProperties(Schema schema, Map<String, Schema> definitions) {
        if (schema.get$ref() != null) {
            String schemaName = MessageReference.extractRefName(schema.get$ref());
            if (definitions.containsKey(schemaName)) {
                this.removeAvroProperties((Schema)definitions.get(schemaName), definitions);
            }
        }

makes infinity recursion

Dependencies and versions used springwolf-kafka version 1.4.0.

Stack trace and error logs

java.lang.RuntimeException: Error occured during creation of AsyncAPI
    at io.github.springwolf.core.asyncapi.DefaultAsyncApiService.getAsyncAPI(DefaultAsyncApiService.java:48) ~[springwolf-core-1.4.0.jar:na]
    at io.github.springwolf.core.SpringwolfInitApplicationListener.onApplicationEvent(SpringwolfInitApplicationListener.java:31) ~[springwolf-core-1.4.0.jar:na]
    at io.github.springwolf.core.SpringwolfInitApplicationListener.onApplicationEvent(SpringwolfInitApplicationListener.java:17) ~[springwolf-core-1.4.0.jar:na]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.boot.context.event.EventPublishingRunListener.ready(EventPublishingRunListener.java:109) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:80) ~[spring-boot-3.2.2.jar:3.2.2]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplicationRunListeners.ready(SpringApplicationRunListeners.java:80) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:348) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.2.jar:3.2.2]
    at ru.vtb.ppcd.datahub.ul.DataHubApplicationKt.main(DataHubApplication.kt:18) ~[classes/:na]
Caused by: java.lang.StackOverflowError: null
    at java.base/java.util.HashMap.hash(HashMap.java:338) ~[na:na]
    at java.base/java.util.HashMap.getNode(HashMap.java:568) ~[na:na]
    at java.base/java.util.LinkedHashMap.getOrDefault(LinkedHashMap.java:453) ~[na:na]
    at io.github.springwolf.core.asyncapi.components.postprocessors.AvroSchemaPostProcessor.removeAvroProperties(AvroSchemaPostProcessor.java:39) ~[springwolf-core-1.4.0.jar:na]
    at io.github.springwolf.core.asyncapi.components.postprocessors.AvroSchemaPostProcessor.removeAvroProperties(AvroSchemaPostProcessor.java:33) ~[springwolf-core-1.4.0.jar:na]
    at io.github.springwolf.core.asyncapi.components.postprocessors.AvroSchemaPostProcessor.lambda$removeAvroProperties$0(AvroSchemaPostProcessor.java:49) ~[springwolf-core-1.4.0.jar:na]
    at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[na:na]
github-actions[bot] commented 3 months ago

Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord.

warorc commented 3 months ago

Our generator problem, sorry guys!