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

持续交易状态下关闭DruidDataSource后,依旧存在部分数据库连接 #4195

Closed
zrlw opened this issue Mar 14, 2021 · 0 comments
Closed
Labels
Milestone

Comments

@zrlw
Copy link
Contributor

zrlw commented Mar 14, 2021

  1. 背景:持续交易状态下切换druid连接池的数据库地址,关闭旧的DruidDataSource,再建新DruidDataSource。
  2. 期望:旧数据库连接全部关闭。
  3. 实际:部分连接数据库地址的连接依旧在。
    初步分析:
    com.alibaba.druid.pool.DruidDataSource的close只是lock加锁,设置closing状态,把connection里的连接close,然后状态设为closed,但是private boolean put(DruidConnectionHolder holder, long createTaskId)这个方法并没有判断closing和closed状态,所以关闭datasource时正在创建的连接依然会存活。
@wenshao wenshao added this to the 1.2.6 milestone Apr 18, 2021
@wenshao wenshao added the Bug label Apr 18, 2021
wenshao added a commit that referenced this issue Sep 20, 2021
zrlw added a commit to zrlw/druid that referenced this issue Mar 24, 2022
wenshao pushed a commit that referenced this issue Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants