无查询时连接超时 运行

Connection timed out when no query running

我正在使用 vertx.io 3.6.3 和 jasync-sql v 1.1.13 for mysql 作为 lib 来管理数据持久性,QA Env 的查询很好但有时我从 lib 收到这样的错误消息:

{"@timestamp":"2020-07-15T06:36:46.933+00:00","level":"ERROR","logger_name":"com.github.jasync.sql.db.mysql.MySQLConnection","message":"<mysql-connection-14> Transport failure ","throwable_class":"IOException","stack_trace":"java.io.IOException: Connection timed out\n\tat sun.nio.ch.FileDispatcherImpl.read0(Native Method)\n\tat sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)\n\tat sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)\n\tat sun.nio.ch.IOUtil.read(IOUtil.java:192)\n\tat sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:377)\n\tat io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:433)\n\tat io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1128)\n\tat io.netty.buffer.SwappedByteBuf.writeBytes(SwappedByteBuf.java:823)\n\tat io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)\n\tat

{"@timestamp":"2020-07-15T08:27:06.070+00:00","level":"DEBUG","logger_name":"com.github.jasync.sql.db.mysql.MySQLConnection" “消息”:“- 客户端断开连接,没有 运行 查询”}

我检查了 mysql 服务器,当时发生了异常,一切正常。

请问有什么方法可以解决吗

非常感谢。

vertx 有它自己的池实现,它有一个参数 connectionReleaseDelay 尝试将它设置为低于数据库超时的数字(以毫秒为单位)。在我设置 connectionReleaseDelay = 600000 ms

后确认它有效