socket close timeout

socket close timeout

am 07.07.2010 10:18:05 von Atton Jonathan

--00151758f42c219020048ac7cf89
Content-Type: text/plain; charset=UTF-8

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 use a lot and sometimes a query of 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(Nativ e Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:5 13)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLErr or.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:25 62)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:25 12)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java :1476)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatem ent.java:100)
at
org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxySta tement.java:57)
at
$java.sql.Statement$$EnhancerByProxool$$331981a9.executeQuer y()
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(ReadAheadInput Stream.java:114)
at
com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingS treamIfNecessary(ReadAheadInputStream.java:161)
at
com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInput Stream.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. 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.

Have you some ideas to fix this ?


--
Regards.

--00151758f42c219020048ac7cf89--

Re: socket close timeout

am 08.07.2010 10:26:28 von Atton Jonathan

--0016e65b64aef879d7048adc0a25
Content-Type: text/plain; charset=UTF-8

I have a new information, the socket is closed after 5 min. What timeout am
I suppose to set in order to fix this ?

2010/7/7 Atton Jonathan

> 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 use a lot and sometimes a query of 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(Nativ e
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:5 13)
> at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
> at
> com.mysql.jdbc.SQLError.createCommunicationsException(SQLErr or.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:25 62)
> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:25 12)
> at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java :1476)
> at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatem ent.java:100)
> at
> org.logicalcobwebs.proxool.ProxyStatement.intercept(ProxySta tement.java:57)
> at
> $java.sql.Statement$$EnhancerByProxool$$331981a9.executeQuer y()
> 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(ReadAheadInput Stream.java:114)
> at
> com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingS treamIfNecessary(ReadAheadInputStream.java:161)
> at
> com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInput Stream.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. 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.
>
> Have you some ideas to fix this ?
>
>
> --
> Regards.
>



--
Regards.

--0016e65b64aef879d7048adc0a25--