• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Timeout issue with MySQL

Mike London
Ranch Hand
Posts: 1290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Despite having tried everything suggested, I'm still getting connection failures after 8 or so hours from my Servlet using Connector/J and MySQL.

Per David's suggestion, I added ?autoReconnect=true to the properties file that has the database login information. I also added the .newInstance() method call to the database connection code (I've read things that say to use .newInstance() and others that say NEVER use it).

Here's the error I keep getting. Any help or suggestions about what I might try next would be *GREATLY* appreciated!!!

-- Mike


Probable cause: Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed


MESSAGE: Software caused connection abort: recv failed


java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1391)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1538)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1929)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1224)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2244)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2192)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1163)
at chat.ChatProcs.doQuery(ChatProcs.java:508)
at chat.ChatProcs.userExists(ChatProcs.java:387)
at chat.Dispatcher.doPost(Dispatcher.java:279)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)

Mike London
Ranch Hand
Posts: 1290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at pages in Google using the search phrase:

Communication link failure: java.net.SocketException

You'll see lots of people who have tried the connection pooling approach, the ?autoReconnect=true approach and, all the links I went to said that after 8 hours, MySQL's timeout happned anyway, no matter what.

I'm not sure what to try next... This doesn't sound like it's configurable.

I hope someone knows what's going on and what will actually re-connect to the database after the timeout ....

Thanks in advance!!!

-- Mike
Jeanne Boyarsky
author & internet detective
Posts: 36032
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That parameter doesn't keep your database connection alive, it just gets one automatically on the first failure. So if you write some custom code, you can get around the problem. If the query fails the first time, try again. The second time is likely to work as the connection will have reconnected.
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!