Validation on classes with a bidirectional relationship cause stack overflow on 6.1.x

Description

We recently upgraded one of our microservices from Spring Boot 2.2 to 2.3 and ran into a bug with hibernate validator that seems to affect all 6.1.x versions. Here is an example that reproduces the issue.


This will trigger a stack overflow...

 

Environment

Spring Boot 2.3.2, Java 11

Activity

Show:
Thom
23 hours ago

To be honest, we suspected our own code as we couldn’t find anyone with the same problem. Is validating bidirectional relations a rare or bad thing to do? I would expect much more people with the same issue if it’s normal, so I’d like to know if this is a bad practice!

Chris Westmorland
22 hours ago

I would agree that unidrectional relations are more common, but I think bidrectional is pretty standard and even necessary in some scenarios, especially if you are directly serializing jpa backed objects.

Guillaume Smet
11 hours ago

Yeah, it's a bug in HV, I have a fix, running the whole test suite right now then will push and release.

Guillaume Smet
7 hours ago

That was an ugly one, thanks for the report and the test case.

I have released 6.1.6.Final. It should be synced to Maven Central sometime tomorrow.

Thom
2 hours ago

Great! I’ll try to test our software using the new version tomorrow.

Assignee

Guillaume Smet

Reporter

Chris Westmorland

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major
Configure