Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

liteflow-rule-sql多数据源连接泄漏 #83

Copy link
Copy link
@handsomestWei

Description

@handsomestWei
Issue body actions

问题版本

<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方法手动关闭,引发连接泄漏

Image

建议

建议在for循环中,获取到连接后,直接break跳出并在方法中返回该连接对象

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.