Error Number: 2006 MySQL server has gone away

Category: Databases

Lwonder
Asked:
2013-09-13 2:55 pm EST

Hits: 613
Recently on our wedding photography blog we've been getting the following message when trying to upload images (after hitting submit). No changes have been made from our side and the only thing I was able to do based on Google searches was try a Database Repair which didnt help. Hoping someone can provide some insight on what needs to be done to avoid this issue so we can return to business as usual. Not sure why but each subsequent attempt produces a different Line Number.

A Database Error Occurred
Error Number: 2006

MySQL server has gone away

SELECT * FROM (`exp_channel_images`) WHERE `entry_id` = '91' AND `site_id` = '1'

Filename: third_party/channel_images/ft.channel_images.php

Line Number: 495

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Jacob - my files range from 173KB to 1044KB.

I'll be able to look more into it this evening. Thanks
Lwonder
11 Points
2013-09-16 02:46 pm EST

OTHER ANSWERS

0

Arn
Staff
15,973 Points
2013-09-13 7:27 pm EST
Hello Lwonder,

Sorry to hear about your database issue. In order for us to help you, we need more information than what you have provided. You have several websites on your account, and we can't determine which one is having the problem. Can you please provide more information on the issue by providing a URL? Also, if you can explain how you're getting to the error, it would also help.

In reviewing your account, you also posted a few support tickets for this issue. If you wish for this problem to be reviewed privately (issues reviewed on the Support Center are public), then please respond to the latest reply to your service ticket.

Apologies again that we can't provide you an immediate answer. Please let us know if you have any further questions or comments.

Regards,
Arnel C.

You must login before you can post a comment about this answer.

Hi Arnel, this is for www.eyewonderphotography.com
I login to my EE admin and create a new blog post, at the bottom of that blog post I am able to upload images images. Once I hit the submit button it processes for a few minutes then times out with the error I initially posted. Let me know what other info you need and I'll be happy to provide it. Thanks!
Lwonder
11 Points
2013-09-13 8:19 pm EST
Hello Lwonder,

How large are the images that you're attempting to upload? It sounds like more than likely you are hitting the server's default wait_timeout=30 setting, limiting the time a single connection can be waited on to 30 seconds.

If you're uploading the same size images as you always have, there could be a possibility that at the time you attempted to upload them the SQL server was a bit backed up and caused it to take longer than 30 seconds. If you've increased the size or quality of your images, you might wish to scale them back so that they can upload quicker.

Taking a look at the database it looks like the last 2 entries have these sizes:

1 MB - 9/12 11:54PM
.58 MB - 9/12 11:52PM


So it very well could have been the time it took to upload one of these caused the issues. You might want to take a look at your coding and see if there is a way that you can handle all the uploading of your images prior to calling your mysql_connect statement, so that the connection isn't held open waiting for the image to be uploaded but rather just called to update the database once the image is already there.

Please let us know if you're still having issues, or if you have any further questions.

- Jacob
JacobIMH
9,962 Points
Staff
2013-09-16 2:35 pm EST
Hello, I wanted to follow up on this issue as it continues to resurface. I would like to know if you can increase the wait_timeout limit to 60? I've been having major issues effectively managing my business blog in terms of image content and with a recent loss of data I need to be able to upload images at a more frequent rate than before.

Please let me know if you can accommodate this. This would only be for the lwonder_ee database.

thanks!
Lwonder
11 Points
2013-10-25 1:43 pm EST
Hello Lwonder,

Unfortunately on a shared hosting server, the MySQL instance is shared between all users, and the MySQL wait_timeout setting of 30 seconds is set to allow for the most common types of database connections, and applies server-wide and can't be adjusted per user or database.

If you were on a VPS or dedicated server you would have the ability to make server-wide changes to the my.cnf file to adjust things like the MySQL wait_timeout setting.

Have you looked into adjusting your application so that it doesn't rely on leaving a connection open to the MySQL server while waiting for an image upload? This would probably be the cheaper alternative than upgrading to more advanced hosting, and the only way I can think of getting around this issue on shared hosting.

- Jacob
JacobIMH
9,962 Points
Staff
2013-10-25 2:24 pm EST
Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!