MyCATApache / Mycat-Server

GNU General Public License v2.0
9.51k stars 3.85k forks source link

idle timeout,close connection,reason: idle ,MySQLConnection #2948

Open DaiYuanchuan opened 9 months ago

DaiYuanchuan commented 9 months ago

1、bug描述 mycat报错日志: 2024-01-28 17:21:43.553 INFO [Timer1] (io.mycat.net.AbstractConnection.idleCheck(AbstractConnection.java:531)) - MySQLConnection [id=24, lastTime=1706433403352, user=apsp, schema=apsp, old shema=apsp, borrowed=false, fromSlaveDB=false, threadId=304180, charset=utf8, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=192.168.1.1, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false] idle timeout 2024-01-28 17:21:43.553 INFO [Timer1] (io.mycat.net.AbstractConnection.close(AbstractConnection.java:514)) - close connection,reason: idle ,MySQLConnection [id=24, lastTime=1706433703552, user=apsp, schema=apsp, old shema=apsp, borrowed=true, fromSlaveDB=false, threadId=304180, charset=utf8, txIsolation=3, autocommit=true, attachment=di{select * from user_info where id =123}, respHandler=io.mycat.backend.mysql.nio.handler.MultiNodeQueryHandler@60ba6b93, host=192.168.1.1, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

2、版本号(非常重要) mycat: v 1.6.5-RELEASE mysql: 5.7.43

3、相关表的配置信息 schema.xml `

select 1
<writeHost host="**" url="192.168.1.1:3306" user="apsp" password="**" />

`

server.xml <property name="idleTimeout">300000</property>

4、操作步骤

5、期望结果

6、实际结果

7、额外信息 wait_timeout: 28800 interactive_timeout: 28800

DaiYuanchuan commented 9 months ago

在Java应用层,执行了一条查询语句,在应用层抛出了异常: java.sql.SQLException: closed connection: idle con:MySQLConnection

它可能是在执行查询的时候,拿到了一个已经失效的连接,就是不知道为什么它会拿到一个失效的连接