-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Managed JDBC driver is not deregistered on context shutdown #2612
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
Comments
Interesting. We could deregister the driver on context shutdown since we know about it through configuration. See also this thread |
@snicoll thanks for the link. Tried this ... DemoApplication.java
Still causes leak ...
|
@snicoll Calling the MySQL AbandonedConnectionCleanupThread shutdown() before deregistering the JDBC drivers seems to work...
|
Thanks, helped me |
Latest MySQL Connector seems to be fixed this problem. I notice it after updating spring-boot 1.5.2.RELEASE |
That's good news. Thanks, @sis-yoshiday. That makes this a duplicate of #8447 and it was fixed by d7a1244. |
The problem with this approach (forcefully deregistering in context listener) is that some drivers maintain an internal registration state. That means that while the driver is then removed from the H2 and PostgreSQL are two drivers which behave like that (links point to relevant source line). MySQL and MariaDB drivers don't show such behavior. They leave managing the registration state solely to the |
@marcelstoer There was no approach taken for this issue. It was closed as a duplicate of #8447 which simply upgraded the MySQL driver version. |
I know, it was meant as a comment for @peterboni et.al. who use or used to use a listener to work around shortcomings. |
I just found this comment while trying to debug a warning tomcat9 gives you about |
I would like to relive this thread...what is the reason why Spring Boot does not unregister the JDBC drivers that are used? Sure I can do it myself (more or less with the code provided here) or let tomcat take care of it, but I cannot really see the reason. Especially if you run in application servers without memory leak protection, it is quite a hassle to find out, what causes the memory leak as I was convinced Spring Boot would never on purpose leave something around. Let me know your thoughts on it |
@BenICE This issue was tracking a problem that was caused by the MySQL driver. That problem was fixed in the MySQL driver itself so there was nothing for Spring Boot to do. If you believe that you have found a scenario where Spring Boot should be doing something, please open a new issue with a detailed description of that situation and a small sample project that reproduces it. |
Hi,
I created a new Spring Starter Project in STS (3.6.3.SR1 for Mac) with no code changes and ...
pom.xml
application.properties
Tomcat Web Application Manager: 'Reload' button
catalina.out
Tomcat Web Application Manager - Diagnostics - 'Find leaks' button
The text was updated successfully, but these errors were encountered: