-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Leaked memory with hikariCP when used as a resource inside tomcat #642
Comments
Is the web app configured to destroy the pool at shutdown? It does not look like shutdown is being called. Also, have you tried using the DataSource rather than the driver? |
what kind of configuration ? , I tried lots of methods,and what I managed to shutdown is the AbandonedConnectionCleanupThread , either by using special ServletContextListener implementation , or use the < Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" |
@faroukelabady You probably want something like a ServletContextListener that calls |
@faroukelabady Another possiblity with spring is configuring the See the bean declaration at the bottom here for an example of the destroy method. |
it will work if i configure hikari inside spring , but if I put the hikari configuration into a resource inside tomcat context , that is when the issue occurs |
I don't really know what that means, but it sounds like a Tomcat configuration issue than a HikariCP. We have thousands of users on Tomcat without issues. I suggest you try asking on stackoverflow or the Tomcat mailing list. |
Okay I thought I will get an answer here , thanks for your effort :) |
I can confirm that for a Spring application, adding the destroy-method="close" attribute to the data source as described above does indeed resolve the memory leak reporting by Tomcat 7. |
In the Tomcat's
The following post gives further explanation: http://stackoverflow.com/a/13631242/2008247 |
trying to build a new web application with spring hibernate, tomcat and mysql , at first I created the Hikari datasource programatically , then I decided to move the cofigruation into the context xml , to be able to change it dynamically but when I undeploy my web application I get the following error. I tried to change the put the mysql driver and hikariCP into tomcat directory with no use , also tried to to set classesToInitialize="com.mysql.jdbc.NonRegisteringDriver inside tomcat server xml as follows
< Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"
classesToInitialize="com.mysql.jdbc.NonRegisteringDriver" /> but it only make the first warning disappear while the Hikari warning still exists
Reproduce
configure Hikari as tomocat resource
Expected
when undeploy the web application the connection pool should be closed
Observed
the hikari pool still exists and working in the background which results in a memory leak
The text was updated successfully, but these errors were encountered: