Re: Communications link failure due to underlying exception
Posted by: Peter Andrews
Date: August 03, 2005 08:48AM

Mark,

I am sorry to have abandoned the thread so long. I had neglected to check 'Send replies to this thread to me via email' and was unaware of any replies.

I did as you suggested several weeks ago and have reduced my numbers of connections etcetera considerably (I had inherited these values as a developer new to the team). I found that I actually do need maxIdle to be almost fifty because of very spikey load and otherwise I was connecting and reconnecting far too often. No big deal.

What is a big deal is that I am getting communication failures at almost any time. I have been using testOnIdle and have verified that the validation queries are running at the interval specified (1 every twenty seconds). Even if I switch to testOnBorrow I still can get errors.

I know that real network problems may occur at any time and I am having our network sysadmin investigate. There is some evidence of this since the errors cluster in time across multiple servers.

I did not get errors of this sort (or at least they were hidden from me) before switching to the 3.1.10 driver and simultaneously changing my params to autoreconnect off and the newer validation query paradigm. (I realize multiple changes at once is problematic but I simply wanted to get rid of all the 'set autocommits' and that drove the new driver, new parameters, etcetera).

Here is a sample of failures I am seeing:

** 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:105)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:148)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:176)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1899)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2348)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2858)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:822)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
at com.airs.utilities.server.Entity.find(Entity.java:1238)

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Socket closed

STACKTRACE:

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:105)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:148)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:176)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1899)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2348)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2858)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:822)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
at com.airs.utilities.server.Entity.getLastInsert(Entity.java:2250)

* BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1902)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2401)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2858)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:770)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1288)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2269)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:421)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1384)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1727)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:822)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
at com.airs.utilities.server.Entity.find(Entity.java:1382)


I guess the paradigm is to catch and handle all of these errors but that is problematic. My boss is understandably very touchy about large changes to our core db code and is urging me to back out the changes and go back to autoReconnect. I want to do the exception handling but it is tricky -- am I supposed to catch all possible errors, figure out which ones are connection related, make a new connection, and retry? How many times shoudl I try -- 3, 5, ?? Even figuring out which errors to retry on is dicey. In addition to the errors listed here I have also seen a null exception from inside dbcp because the connection is bad.

Options: ReplyQuote


Subject
Written By
Posted
Re: Communications link failure due to underlying exception
August 03, 2005 08:48AM
June 09, 2006 04:42AM
August 24, 2006 05:27PM
July 15, 2007 04:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.