Hello :)
I am using "mysql-connector-java-5.1.13-bin.jar" in my java projet. The MySQL database and the java application aro en the name server, I use localhost to access to the database.
My database is used a lot and sometimes a query from the java application can be locked because an other query is running. And sometimes I have this exception :
The last packet successfully received from the server was 315,737 milliseconds ago. The last packet sent successfully to the server was 76 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3055)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2512)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1476)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
at $java.sql.Statement$$EnhancerByProxool$$331981a9.executeQuery(<generated>)
at *****.getNbOcc(Utils.java:72)
at ****(Report.java:453)
at ***
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2499)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2952)
... 19 more
It seems to be a socket timeout. It happens after 5 minutes. The query is still alive in Mysql and will be execute. I have a python application which can wait a long time (1h ...) and still working, consequently the problem seems to com frome Java or the mysql connector.
I think that the socket is not used while the query is locked and maybe java has a timeout on it and close it.
My jdbc configuration:
<alias>baseTickets</alias>
<driver-url>jdbc:mysql://ulogsi1p.cm-cic.fr/baseTickets</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="u.ao;u.,au.u.,"/>
<property name="password" value="popiuou.oau."/>
</driver-properties><maximum-connection-count>10</maximum-connection-count>
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
<autoReconnect>true</autoReconnect>
<maximum-connection-lifetime>118000000</maximum-connection-lifetime>
<wait-timeout>999999</wait-timeout>
<idle-timeout-minutes>99999</idle-timeout-minutes>
<timeout>999999</timeout>
Have you some ideas to fix this ?
I am using "mysql-connector-java-5.1.13-bin.jar" in my java projet. The MySQL database and the java application aro en the name server, I use localhost to access to the database.
My database is used a lot and sometimes a query from the java application can be locked because an other query is running. And sometimes I have this exception :
The last packet successfully received from the server was 315,737 milliseconds ago. The last packet sent successfully to the server was 76 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3055)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2562)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2512)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1476)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:100)
at org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxyStatement.java:57)
at $java.sql.Statement$$EnhancerByProxool$$331981a9.executeQuery(<generated>)
at *****.getNbOcc(Utils.java:72)
at ****(Report.java:453)
at ***
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2499)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2952)
... 19 more
It seems to be a socket timeout. It happens after 5 minutes. The query is still alive in Mysql and will be execute. I have a python application which can wait a long time (1h ...) and still working, consequently the problem seems to com frome Java or the mysql connector.
I think that the socket is not used while the query is locked and maybe java has a timeout on it and close it.
My jdbc configuration:
<alias>baseTickets</alias>
<driver-url>jdbc:mysql://ulogsi1p.cm-cic.fr/baseTickets</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="u.ao;u.,au.u.,"/>
<property name="password" value="popiuou.oau."/>
</driver-properties><maximum-connection-count>10</maximum-connection-count>
<house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
<autoReconnect>true</autoReconnect>
<maximum-connection-lifetime>118000000</maximum-connection-lifetime>
<wait-timeout>999999</wait-timeout>
<idle-timeout-minutes>99999</idle-timeout-minutes>
<timeout>999999</timeout>
Have you some ideas to fix this ?