question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Encoutering memory issues post Spring boot 2.7.1 version

See original GitHub issue

After upgrading our applications to Spring boot 2.7.1 version, we have started encountering memory issues.

Our Observations

Changes were made in 2.7.1 in the org.springframework.boot.loader.jar package around closing jar files. A list of nested jars were added and that is what is holding on to objects in our heap dump.

We can see 22,000 JarFile objects in the heap dump where we’d expect about 118 as that is how many nested jars there are in the application. Note that apart from the expected jar files, the other 22,000-odd are all url = jar:file:/deployments/application-web-1.0.0.jar!/BOOT-INF/lib/swagger-ui-4.11.1.jar!/

Please find below the heap dump and Dynatrace screenshot as reference

image

image

Note :- No changes were made in org.springframework.boot.loader.jar package in 2.7.2 so I suspect the problem will still be there.

Can someone please look into this.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
beggsj42commented, Aug 17, 2022

I believe we’re using the JarLauncher - we’re just using the spring-boot-maven-plugin and we’re not overriding the ‘layout’.

1reaction
beggsj42commented, Aug 17, 2022

Hi @philwebb - I work with @loveshjain and am looking at this. Our problem is that we haven’t been able to replicate this in non-prod. I’m going to see what I can do in that regard in the next couple of days.

I’m speculating that this might have to do with the JarFile objects being removed by the GC (as they are soft referenced?) if there is memory pressure, and then being reloaded later, but never getting removed from the nested jars list? I’ve never really looked at custom class loader code though so I’m a bit in the dark. Does that sound reasonable though - to maybe try to get the JVM close to the heap limit and see if that causes it? I’m just looking for things to try really.

It was fairly odd behaviour in production - it went for several days without us noticing an issue, and when we did hit the issue it wasn’t in a high-load period and it seemed to self-correct. In the tenured gen picture above it looks like it started to have a GC issue about 10am, but we didn’t notice until it started affecting response time badly at about 9:45pm.

We have had similar issues on multiple services though and rolling back to 2.7.0 resolved it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. Learn the Spring basics. Spring Boot builds on many other Spring...
Read more >
h2 - Spring Boot 2.7.0 Liquibase fails with "Migration files for ...
4.200 to v2.1.212, Liquibase then fails with the H2 in memory database. Exception encountered during context initialization - cancelling refresh ...
Read more >
3. Resolved and Known Issues Red Hat JBoss Enterprise ...
This release of JBoss EAP 6 fixes a memory leak caused by an application deployed that is using jboss-ejb-client.xml to configure remote EJB...
Read more >
LTS Changelog - Jenkins
(issue 69467); Fix Java version check in /etc/init.d/jenkins . ... Jenkins 2.4 or 2.7.1 LTS, a Setup Wizard may appear on the startup...
Read more >
Jackson Dependency Issue in Spring Boot with Maven Build
Recently while working with Jackson within a Spring Boot project, I encountered an issue I'd like to share with you.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found