The last packet successfully received from the server was X milliseconds ago. The last packet sent successfully to the server was Y milliseconds ago.
Par PlaceOweb le mardi, décembre 1 2015, 06:21 - SQL - Lien permanent
The last packet successfully received from the server was X milliseconds ago. The last packet sent successfully to the server was Y milliseconds ago.
MySQL server has gone away
2015-12-01 09:01:45,010 FATAL (EJB default - 7) class com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 13 973 milliseconds ago. The last packet sent successfully to the server was 3 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_60] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_60] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_60] at java.lang.reflect.Constructor.newInstance(Constructor.java:422) [rt.jar:1.8.0_60] at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1129) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3720) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3609) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4160) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2313) at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462) ... 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:3166) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3620) ... 58 more
standalone-ha.xml (avant)
<subsystem xmlns="urn:jboss:domain:datasources:1.2"> <datasources> <datasource jta="false" jndi-name="java:jboss/datasources/DsClient" pool-name="MySQLPoolDsScotClient" enabled="true" spy="false"> <connection-url>jdbc:mysql://mariadb.host:3306/database</connection-url> <driver>mysql</driver> <pool> <max-pool-size>30</max-pool-size> </pool> <security> <user-name>sql_user</user-name> <password>sql_password</password> </security> <statement> <track-statements>true</track-statements> <share-prepared-statements>false</share-prepared-statements> </statement> </datasource> <drivers> <driver name="mysql" module="com.mysql"> <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> </driver> </drivers> </datasources> </subsystem>
show variables like '%timeout%';
+-----------------------------+----------+ | Variable_name | Value | +-----------------------------+----------+ | connect_timeout | 10 | | deadlock_timeout_long | 50000000 | | deadlock_timeout_short | 10000 | | delayed_insert_timeout | 300 | | innodb_flush_log_at_timeout | 1 | | innodb_lock_wait_timeout | 50 | | innodb_rollback_on_timeout | OFF | | interactive_timeout | 28800 | | lock_wait_timeout | 31536000 | | net_read_timeout | 30 | | net_write_timeout | 60 | | slave_net_timeout | 3600 | | thread_pool_idle_timeout | 60 | | wait_timeout | 28800 | +-----------------------------+----------+
Ressources :
- MySQL reconnect issues or ‘The last packet successfully received from the server XX milliseconds ago’ errors The last packet sent successfully to the server was 50,286,809 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
- Application is not Accessible due to stale connection in Connection pool
- The last packet successfully received from the server was X milliseconds ago
- Solving a “communications link failure” with JDBC and MySQL
- Connector/J
standalone-ha.xml (après)
<subsystem xmlns="urn:jboss:domain:datasources:1.2"> <datasources> <datasource jta="false" jndi-name="java:jboss/datasources/DsScotClient" pool-name="MySQLPoolDsClient" enabled="true" use-ccm="true" statistics-enabled="true"> <connection-url>jdbc:mysql://mariadb-ha.host:3306/database?disableLocalTxn=true</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <connection-property name="autoReconnect"> true </connection-property> <driver>com.mysql</driver> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <pool> <max-pool-size>50</max-pool-size> <flush-strategy>IdleConnections</flush-strategy> </pool> <security> <user-name>sql_user</user-name> <password>sql_password</password> </security> <validation> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/> <check-valid-connection-sql>SELECT 1;</check-valid-connection-sql> <validate-on-match>true</validate-on-match> <background-validation>true</background-validation> <background-validation-millis>3000</background-validation-millis> <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLStaleConnectionChecker"/> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/> </validation> <timeout> <idle-timeout-minutes>0</idle-timeout-minutes> <query-timeout>60</query-timeout> <allocation-retry>2</allocation-retry> </timeout> <statement> <track-statements>true</track-statements> <prepared-statement-cache-size>100</prepared-statement-cache-size> <share-prepared-statements>true</share-prepared-statements> </statement> </datasource> <drivers> <driver name="com.mysql" module="com.mysql"> <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> </driver> </drivers> </datasources> </subsystem>