Search code examples
jasync-sql

Connection timed out when no query running


I am using vertx.io 3.6.3 and jasync-sql v 1.1.13 for mysql as lib to manage data persistence, The query at QA Env is fine but sometime I receive error message from lib like that :

{"@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","message":" - client got disconnected with no running query"}

I checked the mysql server at time exception happend, everything is ok.

Do can you suggest which way to solve it.

Thanks so much.


Solution

  • vertx has it's own pool impl, it has a parameter connectionReleaseDelay try to set it to a number lower than the db timeout (it's in millis). Confirm it worked after I set connectionReleaseDelay = 600000 ms