0

I am currently running some java code which makes extensive calls to a mysql database. These calls are flooding the database and after a few hours of the code running I am getting a nested exception:

java.io.EOFException
    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1934)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2380)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2909)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:798)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3700)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1203)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2572)


Last packet sent to the server was 8789 ms ago.
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2592)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2909)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:798)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3700)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1203)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2572)

Unfortunately I do not have much experience with this kind of problem, can anyone recommend ways to ensure all my queries can be processed?

I can appreciate this is a very broad question, but the queries themselves are not difficult, it is more the scale of the number of queries I am requesting.

Thanks

4
  • This sounds like a problem that may be helped by logging so you can see what your program is doing at various times, and in particular the program's state when it gets into trouble. Are you currently using logging for this app? Commented Aug 26, 2012 at 3:03
  • I am using basic output logging yes, the problem is in the scope of the size of the users in the database, meaning it will fail at some arbitrary user due to hang in the sql database. show processlist will show the query which has caused the system to hang, but it is at an arbitrary point in the user set.. Commented Aug 26, 2012 at 3:06
  • 1
    Check the number of open connections that are there for your database. If you're opening an increasingly huge amount of connection, then I would suggest connection pooling. In the same context, what is the majority type of the queries to your DB? Are they select queries or you trying to perform database updates? Commented Aug 26, 2012 at 3:13
  • They are all select queries for different user ids. Commented Aug 26, 2012 at 3:17

1 Answer 1

1

I would troubleshoot this at the OS/MySql/Web server level. In other words, this isn't a "Java" problem per se. It's probably much more a "system performance/system configuration" issue.

SUGGESTION:

1) You haven't specified your OS, Web server/application server. These are key.

2) Run basic performance checks (ps -eaf and iostat for Linux, Task Mgr/CPU/Memory/Networking stats for Windows). Pay particular attention to "netstat" (Linux and Windows).

3) Look at all the relevant logs (/var/log/messages etc for Linux; EventVwr, etc for Windows)

4) Check your OS, DB and Web server configuration settings.

5) Pay particular attention to possible "stale connections" and DB-related "connection pooling" parameters.

Check these links:

Sign up to request clarification or add additional context in comments.

5 Comments

I am happy with my set up for 1-4, but I have read the linked articles and made updates. I will re-run my code now and hopefully get better results. Thanks and I will post back.
Q: What is your setup? Windows? Linux? Tomcat? JBoss?
Q: Are you running a standalone Java applicaton? A Java servlet in a Tomcat container? An application server like JBoss or WebSphere? What version(s)?
It's a standalone java app, no web interactions. Why?
Connection pooling and toying with the wait_timeout worked for me. Thanks Paul.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.