SpringBoot sun.security.ssl.SSLSessionContextImpl Memory leak

Viewed 2833

The project uses SpringBoot 2.x, openjdk 1.8.0_232

Recently found that it can be consumed slowly. Through mat analysis, it is found that sun.security.ssl.SSLSessionContextImpl takes up a lot of memory over time

enter image description here

enter image description here

3 Answers

Some people say by setting SSLContext.getDefault().getServerSessionContext().setSessionCacheSize(10);

I set it but it is invalid, maybe my way is wrong; I put it directly in the startup class to initialize

Have the exact same problem, but in a Grails app (also based on Spring Boot 1.5.x). The problem persists also after settings those parameters - sessionCacheSize and sessionTimeout - to small values: 10 and 60 respectively.

Unfortunately i think you have came across a JDK BUG that has not been fixed yet.

Below are the details

https://bugs.openjdk.java.net/browse/JDK-8186628

https://bugs.openjdk.java.net/browse/JDK-8202086

So here are your options in my opinion as of now.

1 try with latest version of Java which most probably will not be feasible for PROD environment

2 Wait for the bug fix.

3 Fix the bug yourself and submit it at appropriate channel.

4 Try to find some other way around like reusing existing session maybe?????

Related