当前使用版本(必填,否则不予处理)

3.2.1

该问题是如何引起的?(确定最新版也有问题再提!!!)

项目运行一段时间后,就会报错获取不到链接。排查不清具体原因,请帮忙确认问题原因? 多数据源只配置了一个数据源:master spring: datasource: dynamic: primary: master datasource:

SqlRunner 使用方式: SqlRunner sqlRunner = new SqlRunner(); sqlRunner.selectList("*sql");

重现步骤(如果有就写完整)

报错信息

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: master - Connection is not available, request timed out after 30000ms.

The error may involve com.baomidou.mybatisplus.core.mapper.SqlRunner.SelectList

The error occurred while executing a query

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: master - Connection is not available, request timed out after 30000ms.] with root cause

Comment From: huayanYu

请你们运维或者找动DB的人帮你排查数据库配置。

Comment From: rollstones

请你们运维或者找动DB的人帮你排查数据库配置。

确定数据库配置没有问题

Comment From: huayanYu

那就是连接池配置问题。~尤其是hikaricp 经常会出现这个问题。

Comment From: rollstones

那就是连接池配置问题。~尤其是hikaricp 经常会出现这个问题。

那就是连接池配置问题。~尤其是hikaricp 经常会出现这个问题。 确实是用的hikaricp ,之前换成过druid 也是不行。问题是现在运行一段时间后,通过SqlRunner 去查询会报错获取不到连接,其他形式的查询没问题。 发现每次查询的时候总是提示这个: Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@66670e54] was not registered for synchronization because synchronization is not active JDBC Connection [HikariProxyConnection@319144738 wrapping com.mysql.jdbc.JDBC4Connection@31df1e58] will not be managed by Spring

Comment From: huayanYu

上面是未受spring事务管理, 本问题请自行查找hikaricp 参数调优等。  如有确切证明是mp引起的bug请重提ISSUE或者PR。