After upgrading from 3.1.6 to 3.2.4, our gradlew test command fails with out of memory.

Memory usage is steady in 3.2.4 version.

3.1.6 3-1-6

3.2.4 3-2-4

In the heapdump report gives this error 18 instances of “org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator”, loaded by “jdk.internal.loader.ClassLoaders$AppClassLoader @ 0xe100b9a0” occupy 11,88,38,000 (23.05%) bytes.

Dominator tree 2024-04-04 12_48_45-Eclipse Memory Analyzer

Comment From: bclozel

Sorry but this report isn't actionable on our side. We have no knowledge of an existing issue that could explain this. Maybe you can provide a minimal sample application that reproduces the problem?

Comment From: msoldin

Also facing the same Problem here, currently running 3.0.2, upgrading to 3.2.4 fails because of an Out Of Memory Exception.

Comment From: sann3

I am not sure how to create a sample application, since it is failing on running many tests, but I will try creating one. Meanwhile here attaching the dependency list, hope it will be useful to some extent. dep.txt

Comment From: wilkinsona

Upgrading from Spring Boot 3.1.6 to 3.2.4 also upgrades from Spring Framework 6.0.14 to 6.1.5. It would be useful to know if the problem occurs with Spring Boot 3.1.6 when Spring Framework's version is overridden to 6.1.5.

Also, as you have a heap dump of the problem, you could also analyse it to see what's referencing the AnnotationAwareAspectJAutoProxyCreator instances and preventing them from being garbage collected. It may be Spring Framework's context caching in its test framework in which case limiting the size of the cache may help.

Comment From: sann3

I have just upgraded the Spring Framework to 6.1.5, not faced the OOM issue. It not look like the cache issue, correct me if I am wrong.

2024-04-08 16_16_52-Eclipse Memory Analyzer

2024-04-08 16_17_57-Eclipse Memory Analyzer

2024-04-08 16_19_19-Eclipse Memory Analyzer

2024-04-08 16_22_04-Eclipse Memory Analyzer

2024-04-08 16_22_29-Eclipse Memory Analyzer

Comment From: wilkinsona

I think those screenshots are showing what's retaining heap memory but not why. It's the why that's interesting here. To start to figure that out, we need to see what's referencing each of the AnnotationAwareAspectJAutoProxyCreator instances.

For us to get any further with this, I think we'll need to see the reproducer that Brian requested above. As things stand, there's no evidence that Spring Boot is the cause of the problem. It could simply be that something in your tests is using slightly more memory that before and that is sufficient to cause the failure.

Comment From: sann3

In all AnnotationAwareAspectJAutoProxyCreator objectsadvisorsCache java.util.concurrent.ConcurrentHashMap is taking more memory

2024-04-08 16_34_07-Eclipse Memory Analyzer

Comment From: sann3

Previously test's were using around 500MB, now it need around 750MB. While running the application also we see this pattern of increased memory usage. Anyway I will try to create sample application.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: sann3

We have upgraded to 3.2.5, observed only gradle test was expecting 200mb extra memory. While running the application memory usage is same as before. But still not found the reason for increased memory usage.

We added the following test task in gradle maxHeapSize = "800m" systemProperty("spring.test.context.cache.maxSize", 30)

I know this might not be useful much, but still like to close the thread.