Re: socket close timeout

Atton Jonathan <[email protected]> Thu, 8 Jul 2010 10:26:28 +0200
Newsgroups gmane.comp.db.mysql.odbc
Message-ID <[email protected]>
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 <[email protected]>

> 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(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. 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.