Skip to content

JarFile can cause memory issues when running on Java 11+ #22991

@alexey-anufriev

Description

@alexey-anufriev

Description

After upgrade from Spring Boot 2.2.6 to 2.2.7 application started consuming much more memory.
In particular Heap Dump shows significantly higher number of instances of type:
org.springframework.boot.loader.jar.JarFile.

Heap Dump (v2.2.6) is here.
It contains the following number of instances:
v226

Heap Dump (v2.2.7) is here.
It contains the following number of instances:
v227

The number of instances is significantly higher.

Reason

After checking the history of related changes there is a couple of commits that worth to be checked:

Create new JarFile instance for URL connections

Attempt to prevent JarFiles from being left open

Attempt to prevent JarFiles from being left open

Steps to reproduce

The following repository can be used:
https://github.com/alexey-anufriev/spring-boot-2.2.7-memory-leak#steps-to-reproduce

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions