-
Notifications
You must be signed in to change notification settings - Fork 474
Open
Description
问题版本
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-rule-sql</artifactId>
<version>2.12.2</version>
</dependency>
使用场景
规则配置源
使用SQL数据库配置源
,并开启自动轮询刷新
liteflow:
rule-source-ext-data-map:
...
pollingEnabled: true
pollingIntervalSeconds: 60
pollingStartSeconds: 60
...
问题现象
数据库连接泄漏,占满连接池,均指向CHECK_SQL_PATTERN = "SELECT {},{} FROM {}"
轮询检查sql
[arthas@1]$ vmtool --action getInstances --className com.alibaba.druid.pool.DruidDataSource --express 'instances[2].getActiveCount()'
@Integer[100]
[arthas@1]$ vmtool --action getInstances --className com.alibaba.druid.pool.DruidDataSource --express 'instances[2].getDataSourceStat().getConnectionList()'
问题代码
项目中配置了多数据源,指向同一个数据库,如sharding
在com.yomahub.liteflow.parser.sql.util
包的LiteFlowJdbcUtil
类的getConn
方法中
遍历多数据源从for循环中取出connection = dataSource.getConnection();
后,多数据源均满足条件,被重复赋值的connection
对象没有执行close方法手动关闭,引发连接泄漏
建议
建议在for循环中,获取到连接后,直接break跳出并在方法中返回该连接对象
Metadata
Metadata
Assignees
Labels
No labels