473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Connection timed out.

Dheeraj Joshi
1,123 Expert 1GB
My colleague is facing an issue with MySQL. I am asking question on behalf of him.

He has created an application and they use MySQL as database. The application is in Java and they use NHibernate.

When the application run continuously database connection is getting closed after 21 Hours.

Error in the log file is
java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Software caused connection abort: recv failed

STACKTRACE:

java.net.SocketException: Software caused connection abort: recv failed
And i suppose if we don't query the database, database connection will get closed after 8 hours...
Where to change this behavior.?

Is it really a MySQL problem.?

Regards
Dheeraj Joshi
Jan 12 '10 #1
10 5607
dgreenhouse
250 Expert 100+
Your friend will have to put a "Is Connection Live?" check in the code and reconnect if the connection dies.
Jan 13 '10 #2
Dheeraj Joshi
1,123 Expert 1GB
Ok.... So basically i am trying to find out, why the connections gets timed out.?

Regards
Dheeraj Joshi
Jan 13 '10 #3
dgreenhouse
250 Expert 100+
I have no idea, but a 21 hour run is pretty long.

Why is it open so long? I have had connections open that long, but is it really necessary in this case? I guess I have to assume it is.

Is it always roughly about 21 hours?

There are a number of MySQL settings, but they may or may not have access to them in their environment.

It might be that the app bogs down after it has been running awhile and doesn't have any activity with the database withing its set timeout period - ergo - the timeout.
Jan 13 '10 #4
Dheeraj Joshi
1,123 Expert 1GB
They are doing testing of the application by keeping it running.
They are inserting the data, updating etc etc..

Yeah it's roughly around 21 hours , once it was also up and running for 36 hours.
But mostly 21 hours....

Regards
Dheeraj Joshi
Jan 13 '10 #5
dgreenhouse
250 Expert 100+
I have no idea, but a 21 hour run is a long time.

MySQL has a number of run time options some of which may or may not be available in their environment.

It could be the app is bogging down at the 20+ hours mark and isn't doing any database interaction and going over the MySQL's connection timeout setting.

If it's on a hosted account, maybe they have some stuff running that's disconnecting.

Network failures, etc., etc., etc.

Google:
http://www.google.com/search?q=mysql...t+setting+java
Jan 13 '10 #6
dgreenhouse
250 Expert 100+
As stated, they should place some "guard" code in the application and reconnect on failure.

~ It's not IF it's WHEN ~
Jan 13 '10 #7
Dheeraj Joshi
1,123 Expert 1GB
I don't know about the runtime configurations of MySQL.

I will see, what they are doing and post.

Regards
Dheeraj Joshi
Jan 13 '10 #8
Dheeraj Joshi
1,123 Expert 1GB
Here is a link which speaks about same issue...

Link

Regards
Dheeraj Joshi
Jan 13 '10 #9
dgreenhouse
250 Expert 100+
@dheerajjoshim
Bill Karwin's response in that thread is correct.

Any robust application has to constantly check for failure conditions and act accordingly.

You HAVE to ALWAYS expect that your application is going to get network failures, machine crashes, access permissions denials, etc., and react appropriately. Many times the application's only alternative is to just log a failure and die. ~ It's not IF it's WHEN ~

But as far as DB timeouts are concerned, you have to expect them at every potential point of failure, and reconnect if possible after detection (Guard Conditions).

You have to love writing error detection and mitigation code as that's the only way your applications will run properly and mark it as professional.

It's a big subject and there's a lot of information available to help in developing good strategies.
Jan 15 '10 #10
mwasif
802 Expert 512MB
What are interactive_timeout and wait_timeout values in MySQL configuration file (my.cnf/my.ini)? You can check the values on mysql prompt with the following queries
Expand|Select|Wrap|Line Numbers
  1. SHOW VARIABLES LIKE 'interactive_timeout'
Expand|Select|Wrap|Line Numbers
  1. SHOW VARIABLES LIKE 'wait_timeout'
Jan 17 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: mfeingold | last post by:
I am working on a system, which among other things includes a server and a ..net control sitting in an html page and connected to the server. I ran into a couple of problems, you guys might have...
0
by: Anthony Banks | last post by:
I get error below when trying to build my application. Could not copy built outputs to the Web. Unable to add 'C:\Documents and Settings\Anthony...
0
by: nickyeng | last post by:
what is the possibility that java.net.ConnectionException will be thrown ? i have a form in jsp, once finish fill up i enter submit button, it will go thank you page. In Thank you page, i save the...
3
rhitam30111985
by: rhitam30111985 | last post by:
hi all,,, i am testing a web crawler on a site passsed as a command line argument.. it works fine until it finds a server which is down or some other error ... here is my code: #!...
1
by: sherifbk | last post by:
Problem description ============== - I have 4 clients and 1 server (SQL server) - 3 clients are Monitoring console 1 client is operation console - Monitoring console collects some data from...
0
by: nickyeng | last post by:
Hi My program needs to connect to https server and here is my java code: URL server = null; HttpURLConnection conn = null; try{ System.setProperty("javax.net.ssl.keyStore",...
1
by: sree83 | last post by:
I have a remoting server. I have an unmanaged client and some screens(in C#) that use the server. When the clients are up, they get connected to the server and is working fine..but after 1 or 2...
1
by: sahillihas8487 | last post by:
1.Unable to successfully establish a connection to web-server retrieving URI . "Web-server closing the connection after connection was just established." 2."General un-handled exception occurred...
1
by: ninthseven | last post by:
1.Unable to successfully establish a connection to web-server retrieving URI . "Web-server closing the connection after connection was just established." 2."General un-handled exception occurred...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.