Memory leak in BeanValidationEventListener
When doing a lot of inserts/updates with JPA entitymanager, a lot of org.apache.bval.jsr.valueextraction.ValueExtractors instances are created which are not removed by the garbage collector.
See attached images, the sampler shows 12+GB memory usage by these bean validation objects.
When disabling bean validation by setting validation-mode to NONE in persistence.xml, the issue does not arise.
Yeah I think the issue is in Apache BVal.
Creating Validators based on new contexts should be a very lightweight operation and it looks like they are creating quite a lot of objects in the process and keeping references to them.
And a ValidatorFactory shouldn't keep track of all the Validators created as a high number of them can be created dynamically.
Give Hibernate Validator a try and see if you have the same issue. I bet you won't.
Ah, I see now you’re using Apache BVal ? Sorry we don’t maintain that here - unless the problem is in Hibernate ORM?
I would recommend please try Hibernate Validator first, and let us know. Or report this to the Apache JIRA.
Hi , I’ve transferred this issue to the Hibernate Validator project. Could you confirm the version you’ve been using?