?
Solved

My server-side Java program is crashing due to MySQL timeout

Posted on 2009-04-28
4
Medium Priority
?
366 Views
Last Modified: 2013-12-14
After about 6 hours, my server-side Java program refuses to allow anyone to connect. My error is below, maybe someone can make sense out of it.
error.JPG
0
Comment
Question by:andy148
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:Venabili
ID: 24252719
How do you get your connections? Some type of pool?
Looks to me that either you keep reuisng the same object and never check if it is correct or you have issues in your pool... or you simply leave a lot of connections to hang out and you cannot do any more...

Does a restart help?
0
 

Author Comment

by:andy148
ID: 24252804
Yes, a restart does help. I think I'm properly closing connections when they are done, I also automatically close active connections if there is no activity between them in about 10 minutes. It says something about .... is longer than the server configured value of 'wait_timeout'. I'm not sure where this is defined though, it's not in my application. Anyway, would setting 'wait_timeout' to a Ridiculously large number fix the problem (or at least allow the program to last longer without a reboot)? Oh yes, I know it isn't too many connections, I'm still in the testing phase, and I have only 2 computers (so only 2 connections max to the server).
0
 
LVL 20

Accepted Solution

by:
Venabili earned 2000 total points
ID: 24253119
Well - this simply means that a new connection or an action could not be perform until the timeout -- in most cases simply because it is on hold waiting to do anyth9ng because of other connections blocking it. So no - a longer period might even be worse because this will keep your connections waiting... Any chance of leaving some connections for too long so when you try to use them again they are already dead?

I would try to go through the code and track down every opening, usage and closing of a connection. Do you also close Statements, PreparedStatements and ResultSets? Also when it fails again, try to see how many connections are open at the moment (netstat for example)  to the DB server
0
 

Author Comment

by:andy148
ID: 24310976
Sorry for the long delay, I was doing some testing and forgot about this question. I found the problem, I wasn't properly closing the connections. I found that after a bit of testing that there were multiple connections to the server from the same machines. I revised my code and it appears to be working, left server online for more than 24 hours and no problems. Thanks for your help!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month16 days, 2 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question