View Full Version : MySQL server has gone away, yet is still running
03-20-2007, 06:31 PM
I have a script which has a 3 day timeout. The reason being is that it can take some time to complete and also has a point where it sits and waits for user input without doing anything except run through a loop to check AJAX responses. I have found that if it runs for too long and then the "continue" button is clicked I will get the error "MySQL server has gone away" during a critical point. I don't know why this is happening and would like to know why this error #2006 "MySQL server has gone away" is popping up. Anyone have some suggestions?
03-28-2007, 06:29 PM
No ideas? :confused:
Oh well, just checking the connection with PHP's mysql_ping() will have to do for now.
03-28-2007, 07:09 PM
In my opinion this is a really bad design, to have a query wait for user response. Better to separate user response from the query, so the query runs in the background as a CRON job or something, as a result of the user response.
03-30-2007, 03:51 PM
You misunderstand. A query isn't waiting on a user response. The entire script is. On occasion the script runs and hits a point in processing that requires adjusting the contents of a file that only a human is capable of doing. The script then continues on its way after being notified that the information it needs to finish up processing has been added to that file. However, part of its normal processing is to look up information in a DB and to add records to the DB.
For some reason it continues to lose the ability to lookup records after a certain point of waiting for a response. I now have the script ping the database to see if a connection is active. If none is active it re-establishes a connection.
However, after re-establishing the connection it can't select the database because MySQL kicks up the error #2006 "server has gone away" over and over again each time it runs mysql_select_db(). Why this is I have yet to be able to figure out.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.