Forums / General Questions / 2013 Lost connection to MySQL server during query

2013 Lost connection to MySQL server during query

Locked

Views: 15,630

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
7 Jun 2007, 10:56 PM
#1
issy avatar

issy

New Zenner

Join Date:
Jan 2006
Posts:
59
Plugin Contributions:
0

2013 Lost connection to MySQL server during query

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

I have a live store that started displaying this error, I found out that it only happens when UPS Module is on and user is trying to checkout; so I did a fresh install in a subfolder of the same domain to see if I was something on I had done, I downloaded zen-cart 1.3.7 again and I still get the same error.
Any suggestions on how to get this fixed. I can only ship UPS so I really need the UPS Module. I even tried upsxml module, no success.

These are my server settings:

Zen Cart 1.3.7
Server OS: Linux 2.4.21-47.0.1.ELsmp
Database: MySQL 4.0.27-max-log
PHP Version: 4.3.11 (Zend: 1.3.0)

I contatated my hosting service provider and they want to know what the ups module needs in order to work properly.

This is the whole error massage:
2013 Lost connection to MySQL server during query
in:
[select cd.categories_name from atestcart_categories c, atestcart_categories_description cd where c.parent_id = 0 and c.categories_id = cd.categories_id and cd.language_id='1' and c.categories_status=1]

2006 MySQL server has gone away
in:
[select count(*) as total from atestcart_sessions where sesskey = '5612c93e2bae959f70a3eee1de0b6e50']

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

Thanks in advance for looking into this issue.

Have a great day!!

8 Jun 2007, 12:58 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: 2013 Lost connection to MySQL server during query

It would be a lot more effective to troubleshoot starting from the first error, rather than the last, since the last error is likely a result of the preceeding errors.> issy:

This is the whole error massage:
2013 Lost connection to MySQL server during query
in:
[select cd.categories_name from atestcart_categories c, atestcart_categories_description cd where c.parent_id = 0 and c.categories_id = cd.categories_id and cd.language_id='1' and c.categories_status=1]

2006 MySQL server has gone away
in:
[select count(*) as total from atestcart_sessions where sesskey = '<removed>']
I'd recommend talking to your hosting company about why MySQL is dropping connections on you.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Jun 2007, 4:16 AM
#3
issy avatar

issy

New Zenner

Join Date:
Jan 2006
Posts:
59
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

This is all the help I got from my hosting service co.

"Thank you for contacting Online Support. The error "MySQL server has gone away" is a type of timeout error. It may be possible that you will need to modify your script to make your queries more efficient. Unfortunately we are unable to assist with this as we are unable to provide coding/scripting support.

In addition, please make sure you are closing the connection to your database when you are finished working. You may only have up to 50 consecutive requests to your hosting account content within a given period or your site will go down temporarily. This is due to over-utilizing your hosting account's resources.

Please let us know if we may be of further assistance."

I'm not sure what to do...:(

Could you send me a PM to help me look into this, your help will be rewarded ofcourse, I just need to get the site working with ups again, not sure why stopped working, I even tried uploading a fresh ups module but still does not work.

I also tried UPSXML and all I get it's a blank page.

Thank you.

11 Jun 2007, 6:07 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: 2013 Lost connection to MySQL server during query

Is this a consistent problem, or only intermittent during busy times?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Jun 2007, 7:47 AM
#5
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

Sounds like you are on an overloaded Server.

ZenCart provides a default setting in both config files to help overcome this type problem.

** define('USE_PCONNECT', 'false'); // use persistent connections?**

If both config files use the above setting and ZenCart is the only script in your Hosting account using a mySQL database, then the problem could be with your Hoster or, since it only happens when using the UPS Module, with UPS. I also wonder if the problem is as you suspect, a problem with the install / setup of the module itself?

The learning is in the doing.

Potent Products

28 Sep 2007, 8:45 PM
#6
jeffrey avatar

jeffrey

New Zenner

Join Date:
Sep 2007
Posts:
2
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

I had the same 2013 error when I first enabled the USPS module.

By unchecking the "Display Transit Times" box, the error is no longer.

I know you're using the UPS module, not USPS but... you should try un-checking some unnecessary options in the UPS config and see what happens.

Worth a shot at least.

17 Oct 2007, 3:47 PM
#7
briohny12 avatar

briohny12

New Zenner

Join Date:
Jun 2007
Posts:
48
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

So wierd. I had the same 2013 error after i installed USPS. I then unchecked the display transit times box and it works fine now.

Thanks for that jeffrey!

25 Oct 2007, 9:00 PM
#8
us_purchase avatar

us_purchase

New Zenner

Join Date:
Oct 2007
Posts:
24
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

:frusty: I am having the same problem on multiple websites. All worked fine until yesterday. Now when you try to check out you get the error message 2013 Lost connection to MySQL server during query in…

26 Oct 2007, 9:22 AM
#9
briohny12 avatar

briohny12

New Zenner

Join Date:
Jun 2007
Posts:
48
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

I contacted my hosting provider for the same reason. This was their response:

We allow up to 50 simultaneous connections per MySQL user. Any connections made after reaching 50 connections will timeout and not be processed;

Since i was testing the shopping cart, this made sense as I was constantly submitting queries. Now that I have stopped testing and the shop is functioning 'as normal' i don't seem to have the time-out problems anymore.

Maybe you have the same problem??

26 Oct 2007, 4:00 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: 2013 Lost connection to MySQL server during query

NOTE: if you hit this limit by yourself in testing ... you really need to consider what happens when you have customers on your site and might want to consider one of our Zen Cart Certified Hosting sites from the Hosting link at the top of your screen ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

27 Oct 2007, 4:13 AM
#11
tick avatar

tick

New Zenner

Join Date:
Jun 2007
Location:
Phoenix, AZ
Posts:
66
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

Is your hosting provider GoDaddy? We are having a similar issue and had to disable the USPS module. I spent an hour on the phone with them yesterday and am told the issue has been escalated to the network administration staff.

If you're using another provider, then never mind. :)

In any case, what appears to be happening on my site is that the proxy server is taking too long to respond. Thus the USPS module takes a long time to retrieve the quotes. Meanwhile, the MySQL server timeout is set for 20 seconds. So, by the time the USPS module completes or times out, the MySQL connection has been closed by the server and the error message is generated.

To confirm/replicate the issue try running a script that only fetches a URL with cURL. Does it take an extraordinarily long time to complete?

Generations Crafting (Our Zen-Cart storefront)
"
And that's just it, Doc - my mind has always been my Achilles' heel!" -- The Tick

30 Oct 2007, 2:23 PM
#12
wdeuter avatar

wdeuter

New Zenner

Join Date:
Nov 2004
Posts:
5
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

We are in the middle of switching to GoDaddy... because our current provider's servers were not stable enough and are now having your same problem with GoDaddy.

I wish now that I had made a different choice of where to switch to.

We also have the problem when searching in the admin/toolbox.

30 Oct 2007, 2:39 PM
#13
wdeuter avatar

wdeuter

New Zenner

Join Date:
Nov 2004
Posts:
5
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

I replied again and questioned the timeout - again.... We'll see what happens.

GoDaddy's Reply:

Thank you for contacting Online Support. This appears to be an issue with the number of connections you are making to our MySQL server. We allow up to 50 simultaneous connections per MySQL user. Any connections made after reaching 50 connections will timeout and not be processed. If you are not having this number of people connecting simultaneously to our server, then it is likely the connections are not properly disconnecting from the server in the coding.

Unfortunately, we are unable to offer assistance for custom coding, scripting, or programming issues beyond what is available in our Help Center. We recommend using your search engine of preference for assistance in resolving this issue. We apologize for any inconvenience.

Please let us know if we can assist you in any other way.

Regards,

Heather P.
Online Support

Customer Inquiry


My E-Mail to GoDaddy:

Transfer speed seems just fine, it seems to be SQL itself. Perhaps, it's
timeout is set too low?

Anyway, the error occurs in a couple of locations. While checking your
shopping cart, with a few items in it, you get this error:


2013 Lost connection to MySQL server during query
in:
[select products_id, products_price, products_tax_class_id, products_weight,
products_priced_by_attribute, product_is_always_free_shipping,
products_discount_type, products_discount_type_from, products_virtual,
products_model from products where products_id = '639']

2006 MySQL server has gone away
in:
[select count(*) as total from sessions where sesskey =
'269e7ecd7f71e74fb4f858d129ca013f']

Warning: Unknown(): A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0


I can eliminate the error by turning off part of the query (checking for
estimated USPS postage). At first, I thought that there might be an error
in that particular code, but during a standard query on the admin page, we
get this:


2013 Lost connection to MySQL server during query
in:
[SELECT project_version_major, project_version_minor FROM project_version
WHERE project_version_key = 'Zen-Cart Database']
If you were entering information, press the BACK button in your browser and
re-check the information you had entered to be sure you left no blank
fields.

2006 MySQL server has gone away
in:
[select count(*) as total from sessions where sesskey =
'ebbb7103722c202d67f854d549e53f08']
If you were entering information, press the BACK button in your browser and
re-check the information you had entered to be sure you left no blank
fields.

Warning: Unknown(): A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0


30 Oct 2007, 3:40 PM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: 2013 Lost connection to MySQL server during query

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

30 Oct 2007, 6:37 PM
#15
wdeuter avatar

wdeuter

New Zenner

Join Date:
Nov 2004
Posts:
5
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

I think DrByte has the idea...

This is GoDaddy's Final:

Dear Sir/Madam,

Thank you for contacting Online Support.

By default, our shared hosting servers will timeout socket connections after 60 seconds. I would suggest reviewing your sites code and to optimize your database tables to ensure that the connection does not take longer than 60 seconds.

Please let us know if we can help any other way.

Regards,
Dennis R.
Online Support Technician

30 Oct 2007, 7:50 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: 2013 Lost connection to MySQL server during query

For the last 2 weeks GoDaddy users have been reporting problems with timeouts when talking to external servers such as USPS and UPS and so on. They seem to be in denial about it. Just one more reason to stay away from them IMO. They're not focused on eCommerce businesses -- they just want hosting accounts regardless of the service they provide.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Oct 2007, 3:21 AM
#17
tick avatar

tick

New Zenner

Join Date:
Jun 2007
Location:
Phoenix, AZ
Posts:
66
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

Just an FYI... This has been fixed for our site. That seems to have been the case since Sunday.

Also, "Dennis R." is incorrect. While the connect timeout on the server may be 60 seconds, you are not waiting to connect. You were already connected (hence the message "MySQL server has gone away.")

The wait timeout on the DB server I connect to is 20 seconds, which is why my DB connection was dropping while trying to contact USPS.

First tier support at GoDaddy is clueless. It took me 45 minutes to get the first guy to acknowledge that it was an issue on their end. A day later I received an email requesting that I call them back and all the second guy did was try to sell me their proprietary cart solution. -- Yeah, that's what I want: more dependence on GoDaddy. :)

Generations Crafting (Our Zen-Cart storefront)
"
And that's just it, Doc - my mind has always been my Achilles' heel!" -- The Tick

31 Oct 2007, 5:10 PM
#18
wdeuter avatar

wdeuter

New Zenner

Join Date:
Nov 2004
Posts:
5
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

GoDaddy was uncooperative at the wrong time. We were switching providers anyway, so we continued the switch.

We stopped briefly at GoDaddy to test, which was not successful, so we kept moving to Blue Host.

They, so far, seem a whole lot easier to deal with and are a whole lot more familiar with our situation.

I don't have ANY time to waste explaining to a provider, that should know more than I do, what needs to happen, only to have them explain that there isn't much that they can do.

I think that picking a provider that is already familiar with ZenCart, possible problems etc., is a smart idea.

31 Oct 2007, 5:20 PM
#19
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,684
Plugin Contributions:
0

Re: 2013 Lost connection to MySQL server during query

I think that picking a provider that is already familiar with ZenCart, possible problems etc., is a smart idea.

:wink: Exactly!

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.