Bug #18954 java.sql.SQLException, MESSAGE: Communication link failure: java.io.EOFExceptio
Submitted: 10 Apr 2006 14:26 Modified: 31 Mar 2014 11:42
Reporter: gopala krishna Muppana Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version: OS:Linux (Redhat linux enterprise linux 3.)
Assigned to: Alexander Soklakov CPU Architecture:Any

[10 Apr 2006 14:26] gopala krishna Muppana
Description:
Hi, 

   I am working with Redhat Enterprise Linux 3.0. and I installed MySQL - 5.0.18-0. And I am facing a pecular problem. I have written a java application which can connect to the database, and execute queries to fetch information from the tables, and this application must run continously for years. 

   But when I run this application, initially it works very well. But after very few days like 1 or 2, it gives the following problem. So that again I need to stop Java application (Infact I am running multiple instances of same java applications, with different databases in mysql) and need to restart mysql, then restart everything. 

Error
-----

SQLException in the storeMo of IndPakQuiz.java of Idea:java.sql.SQLException: No operations allowed after connection closed.

Connection was closed due to the following exception:

** BEGIN NESTED EXCEPTION **

java.sql.SQLException
MESSAGE: Communication link failure: java.io.EOFException, underlying cause: null

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1394)
        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:2248)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2196)
        at com.mysql.jdbc.Statement.executeQuery(Statement.java:1163)
        at LogDetails.storeMo(LogDetails.java:18)
        at MakeResponse.sendMessage(MakeResponse.java:40)
        at SMPPTest.receive(SMPPTest.java:1195)
        at SMPPTest$SMPPTestPDUEventListener.handleEvent(SMPPTest.java:1265)
        at com.logica.smpp.Receiver.process(Receiver.java:440)
        at com.logica.smpp.Receiver.receiveAsync(Receiver.java:419)
        at com.logica.smpp.ReceiverBase.process(ReceiverBase.java:129)
        at com.logica.smpp.util.ProcessingThread.run(ProcessingThread.java:196)

Please help me in coming out of this problem and it is very urgent for me to come out of this. Thanks in advance. 

Regards,

Gopala Krishna. Muppana.

How to repeat:

We can repeat the same problem if I can execute the same java application again for two to three days.
[10 Apr 2006 15:09] Valeriy Kravchuk
Thank you for a problem report. We need a repeatable test case to be able to find the reason and fix the bug, if any. 

Send your my.cnf content and error log's content for the appropriate period, please.

I had also changed category to a more appropriate one.
[10 Apr 2006 16:17] Mark Matthews
More than likely, you're running into "wait_timeout" killing your connection.

This is from the manual at http://dev.mysql.com/doc/refman/5.0/en/cj-faq.html:

24.3.5.1.4:

Question:

I have a servlet/application that works fine for a day, and then stops working overnight

Answer:

MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the "autoReconnect" parameter (see Section 23.3.3.1, “Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J”).

Also, you should be catching SQLExceptions in your application and dealing with them, rather than propagating them all the way until your application exits, this is just good programming practice. MySQL Connector/J will set the SQLState (see java.sql.SQLException.getSQLState() in your APIDOCS) to "08S01" when it encounters network-connectivity issues during the processing of a query. Your application code should then attempt to re-connect to MySQL at this point.
[10 May 2006 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 Mar 2014 11:42] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.