Skip to content
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

tomcat-jdbc数据源下内存泄露问题 #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kailbin
Copy link

@kailbin kailbin commented Oct 30, 2018

con.prepareStatement 在 MySQL 驱动下,会注册到 ConnectionImpl 的 openStatements 集合里面,除非显式关闭 Statement 或者 Connection,否则Connection会一直保存 Statement 的引用。

因为 DataAccessImpl.getPreparedStatementCreator 里面创建了两次 PreparedStatement,在 tomcat-jdbc 下只会关闭一次,导致每次执行SQL 语句之后 openStatements 都会引用两个 PreparedStatement,但是关闭的时候只关闭了一个,造成内存泄露。

目前只发现 tomcat-jdbc 下有该问题,因为 Spring Boot 默认使用的是 tomcat-jdbc,Rose 集成Spring Boot 之后,不注意的话,常常会出现该问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant