Zen Cart Logo
Forums / General Questions / Cart Error: 2006 MySQL server has gone away

Cart Error: 2006 MySQL server has gone away

Locked

Views: 1,684

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
27 Aug 2009, 06:34
#1
cinedictum avatar

cinedictum

New Zenner

Join Date:
Apr 2009
Posts:
16
Plugin Contributions:
0

Cart Error: 2006 MySQL server has gone away

I am getting this error for my zen-cart from time to time:

2006 MySQL server has gone away

in:

[select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from zen_currencies]

How this can be stopped from happening? I am losing money whenever it happens and only server reboot helps for sometime but within time it happens again.

My hosting support said: your VPS had hit memory limits causing services to stop responding normally.

Could the cart cause that? Or what could be the problem for the above error?

Anyone had this before and/or knows how to fix it?

Thanks,
Shavkat
BestWebForms.com/cart/

29 Aug 2009, 01:05
#2
cinedictum avatar

cinedictum

New Zenner

Join Date:
Apr 2009
Posts:
16
Plugin Contributions:
0

Re: Cart Error: 2006 MySQL server has gone away

Anyone? I really help here...

29 Aug 2009, 01:25
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Cart Error: 2006 MySQL server has gone away

Assuming you're using Zen Cart v1.3.8a, try replacing your /includes/classes/db/mysql/query_factory.php with the one in the attached zip file.

29 Aug 2009, 23:05
#4
cinedictum avatar

cinedictum

New Zenner

Join Date:
Apr 2009
Posts:
16
Plugin Contributions:
0

Re: Cart Error: 2006 MySQL server has gone away

Thanks for your suggestion. I am using Zen Cart 1.3.7 Database Patch Level: 1.3.7 - amI still safe to do this replace?
Also, what would be changed with this operation?

30 Aug 2009, 04:39
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Cart Error: 2006 MySQL server has gone away

It should be fine with v1.3.7 too.

It's really just a bandage to attempt reconnection to the database if it discovers that the connection has been dropped. It does NOT fix the root cause of the problem, which is something your site is experiencing a timeout on (typically while trying to talk to some external resource, but sometimes just related to an overloaded server).

31 Aug 2009, 00:45
#6
cinedictum avatar

cinedictum

New Zenner

Join Date:
Apr 2009
Posts:
16
Plugin Contributions:
0

Re: Cart Error: 2006 MySQL server has gone away

Replaced, thanks! Hope it would help to keep the cart active all the time.

13 Mar 2010, 13:15
#7
ksoup avatar

ksoup

Zen Follower

Join Date:
Jan 2004
Posts:
413
Plugin Contributions:
1

Re: Cart Error: 2006 MySQL server has gone away

  • What version of Zen Cart are you using? 1.3.8a
    • Has your site been upgraded? When? From what version(s)? since an early version - I believe we did 1.3.8 from scratch
    • What addons have you installed? When? Supertracker
    • If you're encountering problems that could be related to your server or hosting company, include the name of your hosting company (not their URL). LiquidWeb
    • HAVE YOU LOOKED IN THE FAQ AREA for answers to your question? (ie: a search for your error message or what you want to edit/change, etc) yes
    • Have you searched the FORUM for your error message or for answers to the question you're asking? yes, multiple times
    • WHEN did the problem "start"? How does that compare with other events of your hosting company, changes you've made to your site files/addons, or your admin settings, etc? after a server switch - they have made many tweaks to the sql settings to try to fix this

*********************************** customer note ************************

Here is the problem the member notified me of:

2006 MySQL server has gone away
in:
[select code, title, symbol_left, symbol_right, decimal_point,
thousands_point, decimal_places, value from zen_currencies]

Refresh left the screen hanging for about 40 secnds and then it loaded up!


How can this query hang? It only returns 2 lines?!

We have the same problem and cannot find a remedy! This error popped up after a server switch. We moved to a bigger, better server.

I have repaired and optimized tables...
Tweaks have been made to the default server sql settings...
I have compared indexes...
I am running the query factory in this thread, too...

Please help!

13 Mar 2010, 13:26
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Cart Error: 2006 MySQL server has gone away

The problem is not with the query it mentions. The one it mentions is the one it's attempting to run AFTER the database connection has died. The dying connection happens as a result of something else happening (before that attempted query), which takes too long to execute and the connection dies as a result of the server database configuration settings (controlled by your hosting company).
The most common cause would be something like trying to get a shipping quote from USPS when their servers are slow or having maintenance. Your site sits and waits for USPS to respond, and when they don't, it finally times out and goes on to the next thing it would normally do to draw the current page; but, since too much time has elapsed and the database connection has died, it can't proceed, thus the error you're seeing. Sometimes the db connection is killed by your hosting company itself, sometimes even by a watchdog process running on the server which kills connections it thinks are dead, perhaps wrongfully.

There are lots of theories on patching the code for workarounds, including enforcing particular timeouts in the calls to external servers in order to minimize the likelihood of the problem manifesting.
It was a good idea to move to a bigger, better server. But maybe there's something wrong in their firewalls or connections to "outside" which might be limiting your site's ability to operate properly, instead forcing it to wait more than it used to? Just an idea.