开发者社区> 问答> 正文

万网共享云主机自带的mysql过几分钟就自动断开怎么解决

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 295,916 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3589) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3478) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4019) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.StatementSpy.execute(StatementSpy.java:842) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:460) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:394) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1040) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3039) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3489) ~[mysql-connector-java-5.1.22.jar:na]
... 15 common frames omitted

22:54:14.580 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqltiming - 5. Statement.execute(select 1) FAILED! select 1
{FAILED after 2 msec}
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 295,916 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3589) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3478) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4019) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.StatementSpy.execute(StatementSpy.java:842) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:460) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:394) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1040) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3039) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3489) ~[mysql-connector-java-5.1.22.jar:na]
... 15 common frames omitted

22:54:14.583 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.audit - 5. Connection.close()
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4808) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4403) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.ConnectionSpy.close(ConnectionSpy.java:895) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:495) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:582) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1042) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

22:54:14.584 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqlonly - 5. Connection.close()
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4808) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4403) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.ConnectionSpy.close(ConnectionSpy.java:895) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:495) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:582) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1042) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

22:54:14.584 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqltiming - 5. Connection.close()
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4808) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4403) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.ConnectionSpy.close(ConnectionSpy.java:895) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:495) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:582) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1042) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

22:54:14.588 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.audit - 4. Statement.execute(select 1) select 1

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 296,728 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3589) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3478) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4019) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.StatementSpy.execute(StatementSpy.java:842) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:460) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:394) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1040) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3039) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3489) ~[mysql-connector-java-5.1.22.jar:na]
... 15 common frames omitted

22:54:14.589 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqlonly - 4. Statement.execute(select 1) select 1

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 296,728 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3589) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3478) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4019) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.StatementSpy.execute(StatementSpy.java:842) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:460) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:394) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1040) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3039) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3489) ~[mysql-connector-java-5.1.22.jar:na]
... 15 common frames omitted

22:54:14.589 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqltiming - 4. Statement.execute(select 1) FAILED! select 1
{FAILED after 2 msec}
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 296,728 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3589) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3478) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4019) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.StatementSpy.execute(StatementSpy.java:842) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:460) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.validate(PooledConnection.java:394) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1040) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3039) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3489) ~[mysql-connector-java-5.1.22.jar:na]
... 15 common frames omitted

22:54:14.592 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.audit - 4. Connection.close()
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4808) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4403) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.ConnectionSpy.close(ConnectionSpy.java:895) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:495) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:582) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1042) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

22:54:14.593 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqlonly - 4. Connection.close()
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4808) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4403) ~[mysql-connector-java-5.1.22.jar:na]
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1594) ~[mysql-connector-java-5.1.22.jar:na]
at net.sf.log4jdbc.ConnectionSpy.close(ConnectionSpy.java:895) ~[log4jdbc-1.2.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(PooledConnection.java:331) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.release(PooledConnection.java:495) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.release(ConnectionPool.java:582) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.testAllIdle(ConnectionPool.java:1042) [tomcat-jdbc-7.0.53.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool$PoolCleaner.run(ConnectionPool.java:1350) [tomcat-jdbc-7.0.53.jar:na]
at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_131]

22:54:14.594 [PoolCleaner[241067384:1498834154350]] ERROR jdbc.sqltiming - 4. Connection.close()

展开
收起
eclipse314 2017-06-30 22:59:42 3682 0
3 条回答
写回答
取消 提交回答
  • 检查一下应用代码是否存在数据库连接泄露。

    2021-10-15 19:46:09
    赞同 展开评论 打赏
  • 1.空闲断开,连接上去长时间未做任何操作(为了把连接空闲出来),服务端给断开了 2. 连接数过多,并发情况下,抢占连接,连接数设置过小导致

    2021-10-11 17:28:55
    赞同 展开评论 打赏
  • 博客:http://nginxs.blog.51cto.com/ github:https://github.com/bashhu

    这个超时应该是数据库设置空闲连接超时时间,活跃连接默认超时时间8小时,网络读写分别是30s和60s,锁等待是50秒,wait_timeout是90s,你看看你这个可能是哪个原因

    2019-07-17 21:21:09
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
One Box: 解读事务与分析一体化数据库 HybridDB for MySQL 立即下载
One Box:解读事务与分析一体化数据库HybridDB for MySQL 立即下载
如何支撑HTAP场景-HybridDB for MySQL系统架构和技术演进 立即下载

相关镜像