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

Avoid infinite recursion in BeanValidationBeanRegistrationAotProcessor with recursive generics #33950

Closed
wants to merge 1 commit into from

Conversation

scordio
Copy link
Contributor

@scordio scordio commented Nov 23, 2024

Prior to this commit, AOT processing for bean validation failed with StackOverflowError for constraints with fields having recursive generic types. With this change, the processing aborts preemptively when a cycle is detected.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 23, 2024
@sbrannen sbrannen added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 23, 2024
@sbrannen sbrannen added this to the 6.2.1 milestone Nov 23, 2024
@sbrannen sbrannen self-assigned this Nov 23, 2024
@scordio scordio force-pushed the gh-33936 branch 2 times, most recently from 1b88059 to 90ea219 Compare November 23, 2024 16:23
@snicoll snicoll changed the title Avoid infinite recursion in AOT processing with recursive generics Avoid infinite recursion in BeanValidationBeanRegistrationAotProcessor with recursive generics Nov 24, 2024
@bjorntj
Copy link

bjorntj commented Nov 24, 2024

I see this is marked as release 6.2.1 but I guess that is a month away. Anyway to get this fix now?

@sbrannen
Copy link
Member

I see this is marked as release 6.2.1 but I guess that is a month away. Anyway to get this fix now?

@bjorntj, we will decide when to release 6.2.1 within the team in the coming days.

@sbrannen sbrannen added type: bug A general bug type: regression A bug that is also a regression and removed type: regression A bug that is also a regression type: bug A general bug labels Nov 24, 2024
sbrannen added a commit that referenced this pull request Nov 24, 2024
@sbrannen sbrannen closed this in 5e7b3a3 Nov 24, 2024
@sbrannen
Copy link
Member

This has been merged into 6.2.x and main in 5e7b3a3 and slightly revised in 051f1da.

Thanks for the PR and for collaborating with me on this at Hack.Commit.Push 2024! 👍

@scordio scordio deleted the gh-33936 branch November 24, 2024 14:25
@edeandrea
Copy link
Contributor

Is there a workaround for this fix or do we need to wait for the next release? Removing the spring-boot-starter-validation dependency isn't a viable workaround in my case.

@sbrannen
Copy link
Member

sbrannen commented Dec 6, 2024

Is there a workaround for this fix or do we need to wait for the next release?

It depends...

If you need the AOT processing to occur, no, there is unfortunately no workaround, and you'll have to wait for the 6.2.1 release which is scheduled for next Thursday.

However, if you just want to run your tests via the build or build your application for standard JVM deployment, you could disable the AOT processing when you run the build.

@edeandrea
Copy link
Contributor

Thanks @sbrannen thats what I thought. In my case I'm running the -PnativeTests in my CI workflow (to ensure that the tests run against a native binary). Thats whats failing. The JVM-only tests run fine (as you stated).

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: regression A bug that is also a regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AOT processing for bean validation causes StackOverflowError
5 participants