java.net.SocketException: Connection reset

Hi all,

We are using a Servoy 3.5.7 and Mysql.

We at time get the following message “Cannot save form data” and then as a result we lose the data for that particular record we want to save or commit.

I checked the server logs and we get the following error

java.net.SocketException: Connection reset
     at java.net.SocketInputStream.read(SocketInputStream.java:168)
     at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
     at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
     at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:723)
     at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:680)
     at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
     at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
     at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
     at java.io.DataInputStream.readInt(DataInputStream.java:353)
     at com.servoy.j2db.util.rmi.d$1.run(Unknown Source)

The following error below is the communication exception error we get from mysql:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Connection reset STACKTRACE: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113) at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160) at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1902) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2351) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2862) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666) at com.mysql.jdbc.Connection.execSQL(Connection.java:2988) at com.mysql.jdbc.Connection.execSQL(Connection.java:2917) at com.mysql.jdbc.Statement.executeQuery(Statement.java:796) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.servoy.j2db.persistence.datasource.p.invoke(Unknown Source) at $Proxy0.executeQuery(Unknown Source) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162) at com.servoy.j2db.persistence.datasource.a.a(Unknown Source) at com.servoy.j2db.persistence.datasource.r.validateObject(Unknown Source) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:833) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110) at com.servoy.j2db.persistence.datasource.i.getConnection(Unknown Source) at com.servoy.j2db.persistence.Server.getConnection(Unknown Source) at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source) at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source) at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor218.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) at java.lang.Thread.run(Thread.java:613) ** END NESTED EXCEPTION ** Last packet sent to the server was 1 ms ago.
     at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2563)
     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2862)
     at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
     at com.mysql.jdbc.Connection.execSQL(Connection.java:2988)
     at com.mysql.jdbc.Connection.execSQL(Connection.java:2917)
     at com.mysql.jdbc.Statement.executeQuery(Statement.java:796)
     at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.servoy.j2db.persistence.datasource.p.invoke(Unknown Source)
     at $Proxy0.executeQuery(Unknown Source)
     at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162)
     at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162)
     at com.servoy.j2db.persistence.datasource.a.a(Unknown Source)
     at com.servoy.j2db.persistence.datasource.r.validateObject(Unknown Source)
     at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:833)
     at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
     at com.servoy.j2db.persistence.datasource.i.getConnection(Unknown Source)
     at com.servoy.j2db.persistence.Server.getConnection(Unknown Source)
     at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source)
     at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source)
     at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source)
     at sun.reflect.GeneratedMethodAccessor218.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
     at sun.rmi.transport.Transport$1.run(Transport.java:153)
     at java.security.AccessController.doPrivileged(Native Method)
     at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
     at java.lang.Thread.run(Thread.java:613)

Following is our server information and I have attached an image with our network settings:
Server Information
Servoy version 3.5.7-build 520, repository version 31

JDK Information
java.vm.name=Java HotSpot™ Client VM
java.vm.version=1.5.0_13-121
java.vm.info=mixed mode
java.vm.vendor=“Apple Computer, Inc.”

Operating System Information
os.name=Mac OS X
os.version=10.4.11
os.arch=ppc

Please let me know what I need to check in the network infrastructure or enable/disable to prevent this error from happening.

Any help would be appreciated.

Regards
James Dcunha

James,

This error means that the mysql has reset (closed) the connection from the server side, probably because of a long period of inactivity while being in the connection pool.
Try setting the validation type to ‘query validation’ and enter a simple query like ‘select 1’ on the server definition.
This will tell Servoy to test the connection using this query before using it from the connection pool.

Rob

Hi all,

Thanks for the reply.

I checked the database server settings and it was already set to “query validation” mode. (Attached is the screenshot)

I have also attached the log file from the server.

Any help would be appreciated.

Regards
James

servoy_log_1.txt (243 KB)

James,

Your logfile shows connection-reset errors, these errors occur when Servoy takes a connection from the pool and tests it (which fails)
I expect Servoy recovers from this by opening a new connection.

The failed save is probably because of a bug in your solution:
Duplicate entry ‘0’ for key 1
indicates that you are trying to save records with PK 0 multiple times.

Rob

Hi Rob,

What is the exact meaning of this Validation Query.
I’ve never understood this and I’ve kept it on Servoys default value (exception validation)

Martin

what is the client error that you get? (look that/enable the java console)

that mysql error is fine. We only shouldnt report this stacktrace i guess it is just that your validation query fails because of a socket that was reset and that can be because it was idle for a long time
(and that error is thrown when you do a perform query not when you are trying to update)

the other error is between the client and the server and also there you get reset errors.
So i would like to see the client errors what the client exactly is telling me.