Jump to content

Fatal error: too many user connections


gestavenir

Recommended Posts

I have a CC install on a 5.6.28 PHP version. Recently, I experienced many fatal errors like those below:

Warning: mysqli::mysqli(): (HY000/1203): User sevcortn_xxxxx already has more than 'max_user_connections' active connections in /home/bouticom/public_html/classes/db/mysqli.class.php on line 33

Warning: mysqli_options(): Couldn't fetch mysqli in /home/bouticom/public_html/classes/db/mysqli.class.php on line 35

Fatal error: User sevcortn_xxxxx already has more than 'max_user_connections' active connections in /home/bouticom/public_html/classes/db/mysqli.class.php on line 38

When I investigated further with the server administrator, I was told that there were a number of select queries that were waiting on a table level lock and was advised to move CubeCart_inventory table to InnoDB storage engine which supports row level locking.

Is it a way to stop having those errors that crash my cart?

Thank you for any help:daisy:

Link to comment
Share on other sites

We are not aware of CubeCart being the entity of locking any part of the database.

That being said, maybe the PHP 5.6.28 is configured (via the mysqli extension settings in the php.ini file) that performs table/row locking as a default action.

We would ask that you consult with your hosting provider to determine if this is the case.

 

Edited by bsmither
Link to comment
Share on other sites

Thank you for coming back to me and sorry for the delay to reply. I was waiting for a sensible answer from the hosting provider.

So I was told that the crash occurred because the website had too many users connected to the database and just hit the limit. The limit is 25 connections. To avoid increasing this limit and more memory usage. I was recommended to optimize the database. There is no reason why one user is using over 25 connections. The table involved is cubecart_inventory. There are more than 3000 articles. Maybe the table is too large and takes time to open. Is is a way to optimize it?

Link to comment
Share on other sites

I always had a concern that a website may be very popular, and the application (like WordPress, CubeCart, etc) that runs it might connect to the database that many number of times of visitors. So, if 30 visitors are viewing your site within, maybe, 5 seconds, does that translate to 30 connections to the database?

I don't know. I haven't made those kinds of experiments.

However, CubeCart keeps copies of standard queries to the database along with the returned recordsets and are stored in its /cache/ folder. (There are events which will clear the cache. And a query can go 'stale' such that CubeCart makes a fresh query to the database.)

So, in admin, Store Settings, Advanced tab, check to see if caching is enabled.

In my opinion, on the one hand, the structure of data in the database (the 'schema') is not overly complex. Any optimization here would only affect the amount of time it would take to return a recordset.

On the other hand, I am aware of numerous instances where the queries themselves could be better formulated to reduce the number of total queries made. But looking at my database's query logs on my development system, I see one connection that comprise numerous queries. So the number of queries it takes to get all the data needed to populate a page, in my opinion, does not affect the number of connections per user.

I would think the number of simultaneous page requests would be the triggering factor, and the only way I know how to limit the number of page requests per slice of time is to implement a web server module like mod_bandwidth or mod_qos.

Edited by bsmither
Link to comment
Share on other sites

Sorry but your hosting company seems to not know what they are talking about.  Optimizing the database is extremely unlikely to have any effect on this issue as the problem is your site hitting hosting limits imposed by your hosting company. 25 simultaneous connections to the database is a reasonable number so either your website is VERY busy or more likely your hosting company has issues with the configuration of the server and / or it is overloaded.

Ian

Link to comment
Share on other sites

Thank you both for your extensive explanation that is way out of my knowledge, I'm afraid:dead:

About the caching, it is enabled. However, looking at the system error log, I can see a lot of error messages like these below. Any idea why?

About the hosting company, the cart is installed on a dedicated server. Maybe I should investigate if I haven't set up those limits myself:wacko:

Today, 17:04 [Notice] /home/public_html/admin_tJi3pD/sources/settings.errorlog.inc.php:61 - Undefined variable: smarty_data
Today, 17:02 [Notice] /home/xxxx/public_html/classes/ssl.class.php:38 - Undefined index: _g
Today, 16:57 [Notice] /home/xxxxpublic_html/classes/ssl.class.php:38 - Undefined index: _g
Today, 16:56 [Notice] /home/xxxx/public_html/classes/ssl.class.php:38 - Undefined index: _g
Today, 16:56 [Notice] /home/xxxx/public_html/classes/ssl.class.php:38 - Undefined index: _g
Today, 16:55 [Warning] /home/xxxx/public_html/admin_tJi3pD/sources/dashboard.index.inc.php:311 - array_keys() expects parameter 1 to be array, boolean given
Today, 16:55 [Notice] /home/xxxx/public_html/admin_tJi3pD/sources/dashboard.index.inc.php:319 - Undefined index: plugin_tabs
Today, 16:55 [Notice] /home/xxxx/public_html/classes/gui.class.php:714 - Undefined index: recaptcha
Today, 16:55 [Notice] /home/xxxx/public_html/classes/admin.class.php:65 - Undefined index: r
Today, 16:54 [Notice] /home/xxxx/public_html/classes/gui.class.php:714 - Undefined index: recaptcha
Today, 16:52 [Warning] /home/xxxx/public_html/admin_tJi3pD/sources/dashboard.index.inc.php:311 - array_keys() expects parameter 1 to be array, boolean given
Today, 16:52 [Notice] /home/xxxx/public_html/admin_tJi3pD/sources/dashboard.index.inc.php:319 - Undefined index: plugin_tabs
Today, 16:52 [Notice] /home/xxxx/public_html/classes/ssl.class.php:38 - Undefined index: _g
Today, 16:52 [Notice] /home/xxxx/public_html/classes/cart.class.php:402 - Undefined variable: stock_warning
Today, 16:52 [Notice] /home/xxxx/public_html/classes/cart.class.php:807 - Undefined index: delivery_address

Today, 16:52

[Notice] /home/xxxx/public_html/classes/cart.class.php:807 - Undefined index: delivery_address 

 

Link to comment
Share on other sites

Any error message that indicates an undefined index or variable can be ignored. The CubeCart developers took the "Don't bother declaring your variables" approach to coding, and PHP is giving a gentle reminder of that.

I believe in CC618, if you turn off debugging, then these Notice entries will no longer get logged.

The Warning array_keys() entry is (probably) a known issue, however.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...