Skip to content

waileong/spring-aot-infinite-recursive

Repository files navigation

Spring AOT StackOverflowError Demonstration

This project demonstrates the reproducibility of spring-framework#33936, where running the AOT (Ahead-of-Time) processing results in a StackOverflowError.

Steps to Reproduce

To reproduce the StackOverflowError, run the following command:

./gradlew aotClasses

This will trigger the AOT processing and produce the stack overflow error due to infinite recursion.

Cause of the StackOverflowError

The issue is caused by the commit 357dbc0, which introduced a recursive processAheadOfTime method without a condition to break the recursion. This leads to an infinite recursive loop and eventually a StackOverflowError.

Suggested Fix

To resolve the issue, add a condition to break the infinite recursive loop by keeping track of the classes that have already been validated.

if (validatedClasses.contains(clazz)) {
  // Break the infinite recursive loop
  logger.debug("Class {} has already been validated.", clazz.getName());
  return;
}

This approach is demonstrated in the following code snippet from the example project:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages