New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New minimumIdle connections every maxLifetime causing MySQL'AbandonedConnectionCleanupThread Memory Leak #1473
Comments
I think it's nothing about Hikari, you can replace |
Number of |
Actually it's not I think, or the heap won't keep growing all the time. |
similar problem exists with mysql:mysql-connector-java:jar:8.0.16 and spring boot and openjdk 1.8. |
@rivenhk @zeeshen It could very well be a bug in the driver, as there are several examples of environments (mainly application containers) where the MySQL driver misbehaves: https://issues.apache.org/jira/browse/NIFI-5501 https://bugs.mysql.com/bug.php?id=69526 One possible answer/lead is here: |
what solved this issue @zeeshen ? facing similar issue |
@bharath2109cred What version of mysql-connector-java are you using? You may want to investigate the relatively new property (mysql) Java system property |
Thanks @brettwooldridge we were also struggling with same issue in our application. |
Make sure you are on the latest version of Connector/J, and set system property
|
Posting this for future users. We had one possible memory leak into our application due to which old generation in our application was never coming down. Configuration of application. When we dig deeper found one configuration miss into Caffeine due to which expired keys were not getting evicted, After fixing this issue we took heap dump of application and found a quite good number of reference of above object. We also tried reproducing above issue on local with very less lifespan of db connection. Quite a good number of those references were getting generated and after moving to latest connector and setting But if application is using hikari or any other connection pool manager, with under right configuration those references will keep on getting collected in timely manner, and should not be trouble. In our application we are having maxlifetime of |
Environment
We've noticed a memory leak in a spring-boot application:
With the help of heap dump and MAT, we found that the memory leak's caused by
Looking into the code base, we found that HikariPool closes the old connections and creates new ones every
maxLifetime
. But these closed connections are not garbage collected correctly by theAbandonedConnectionCleanupThread
of MySQL .We can produce the phenomenon by setting the maxLifetime to a relatively small value like a minute(all other configs are using the default value). Using tools like VisualVM, we can see an obvious increasement of
AbandonedConnectionCleanupThread$ConnectionFinalizerPhantomReference
objects.We're not sure that it's a Hikari issue or a mysql-connector issue actually. As submitting an issue to MySQL project is a little complex, we really hope that you can take a look at this issue. Thank you so much.
The text was updated successfully, but these errors were encountered: