HikariCP icon indicating copy to clipboard operation
HikariCP copied to clipboard

Communications link failure Socket is closed

Open wind-hx opened this issue 2 years ago • 0 comments

  • version:5.0.0
  • os: centos8.2
  • jdk version:java11
  • mysql version:8.0.18

Description

This error occasionally occurs when executing SQL in multiple threads At present, it can only be solved by restarting the project or restarting mysql

2021-11-21 00:00:38.899 [vert.x-eventloop-thread-0] ERROR io.vertx.core.impl.ContextImpl - Unhandled exception
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
### The error may exist in mapper/UserDao.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select           id, uuid, phone, password, nick_name, avatar_url, expire, type, inviter, is_proxy, disable_withdraw, group_limit, user_role, gmt_created, gmt_modified         from t
elegram.user         where id = ?
### Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76) ~[telegram-api.jar:?]
        at jdk.internal.reflect.GeneratedMethodAccessor160.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.apache.ibatis.session.SqlSessionManager$SqlSessionInterceptor.invoke(SqlSessionManager.java:357) ~[telegram-api.jar:?]
        at com.sun.proxy.$Proxy37.selectOne(Unknown Source) ~[?:?]
        at org.apache.ibatis.session.SqlSessionManager.selectOne(SqlSessionManager.java:166) ~[telegram-api.jar:?]
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87) ~[telegram-api.jar:?]
        at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) ~[telegram-api.jar:?]
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[telegram-api.jar:?]
        at com.sun.proxy.$Proxy42.queryById(Unknown Source) ~[?:?]
        at com.wind.telegram.core.service.impl.UserServiceImpl.queryById(UserServiceImpl.java:49) ~[telegram-api.jar:?]
        at com.wind.telegram.api.filter.TokenCheckFilter.lambda$handle$0(TokenCheckFilter.java:92) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureImpl$1.onSuccess(FutureImpl.java:90) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureImpl$ListenerArray.onSuccess(FutureImpl.java:230) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:62) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:179) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:62) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:179) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:41) ~[telegram-api.jar:?]
        at io.vertx.redis.client.impl.BaseRedisClient.lambda$null$0(BaseRedisClient.java:51) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:124) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54) ~[telegram-api.jar:?]
        at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:80) ~[telegram-api.jar:?]
        at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:172) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:179) ~[telegram-api.jar:?]
        at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23) ~[telegram-api.jar:?]
        at io.vertx.core.Promise.complete(Promise.java:66) ~[telegram-api.jar:?]
        at io.vertx.redis.client.impl.RedisStandaloneConnection.lambda$handle$5(RedisStandaloneConnection.java:309) ~[telegram-api.jar:?]
        at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:70) ~[telegram-api.jar:?]
        at io.vertx.core.impl.ContextImpl.execute(ContextImpl.java:268) ~[telegram-api.jar:?]
        at io.vertx.core.impl.AbstractContext.execute(AbstractContext.java:54) ~[telegram-api.jar:?]
        at io.vertx.redis.client.impl.RedisStandaloneConnection.handle(RedisStandaloneConnection.java:283) ~[telegram-api.jar:?]
        at io.vertx.redis.client.impl.RESPParser.handleResponse(RESPParser.java:319) ~[telegram-api.jar:?]
        at io.vertx.redis.client.impl.RESPParser.handle(RESPParser.java:125) ~[telegram-api.jar:?]
        at io.vertx.redis.client.impl.RESPParser.handle(RESPParser.java:24) ~[telegram-api.jar:?]
        at io.vertx.core.net.impl.NetSocketImpl$DataMessageHandler.handle(NetSocketImpl.java:409) ~[telegram-api.jar:?]
        at io.vertx.core.net.impl.NetSocketImpl.lambda$new$1(NetSocketImpl.java:97) ~[telegram-api.jar:?]
        at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:240) ~[telegram-api.jar:?]
        at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:130) ~[telegram-api.jar:?]
        at io.vertx.core.net.impl.NetSocketImpl.lambda$handleMessage$9(NetSocketImpl.java:390) ~[telegram-api.jar:?]
        at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:49) [telegram-api.jar:?]
        at io.vertx.core.impl.DuplicatedContext.emit(DuplicatedContext.java:167) [telegram-api.jar:?]
        at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:389) [telegram-api.jar:?]
        at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:155) [telegram-api.jar:?]
        at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:154) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [telegram-api.jar:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [telegram-api.jar:?]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [telegram-api.jar:?]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [telegram-api.jar:?]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [telegram-api.jar:?]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [telegram-api.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) [telegram-api.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) [telegram-api.jar:?]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) [telegram-api.jar:?]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) [telegram-api.jar:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [telegram-api.jar:?]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [telegram-api.jar:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [telegram-api.jar:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
        at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:370) ~[telegram-api.jar:?]
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) ~[telegram-api.jar:?]
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[telegram-api.jar:?]
        ... 69 more
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[telegram-api.jar:?]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[telegram-api.jar:?]
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[telegram-api.jar:?]
        at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[telegram-api.jar:?]
        at com.mysql.cj.protocol.a.NativeProtocol.clearInputStream(NativeProtocol.java:791) ~[telegram-api.jar:?]
        at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:603) ~[telegram-api.jar:?]
        at com.mysql.cj.protocol.a.NativeProtocol.sendQueryPacket(NativeProtocol.java:970) ~[telegram-api.jar:?]
        at com.mysql.cj.NativeSession.execSQL(NativeSession.java:662) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:930) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:370) ~[telegram-api.jar:?]
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) ~[telegram-api.jar:?]
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[telegram-api.jar:?]
        ... 69 more
Caused by: java.io.IOException: Socket is closed
        at com.mysql.cj.protocol.AbstractSocketConnection.getMysqlInput(AbstractSocketConnection.java:72) ~[telegram-api.jar:?]
        at com.mysql.cj.protocol.a.NativeProtocol.clearInputStream(NativeProtocol.java:787) ~[telegram-api.jar:?]
        at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:603) ~[telegram-api.jar:?]
        at com.mysql.cj.protocol.a.NativeProtocol.sendQueryPacket(NativeProtocol.java:970) ~[telegram-api.jar:?]
        at com.mysql.cj.NativeSession.execSQL(NativeSession.java:662) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:930) ~[telegram-api.jar:?]
        at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:370) ~[telegram-api.jar:?]
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) ~[telegram-api.jar:?]
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[telegram-api.jar:?]
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) ~[telegram-api.jar:?]
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ~[telegram-api.jar:?]

wind-hx avatar Nov 20 '21 16:11 wind-hx