XF 2.2 Admin-side errors on Xenforo forum and query recommendation from host

Miri

Well-known member
I have been experiencing a few admin-side errors on my forum (Xenforo) for the past couple of days.
The error message is as follows:

Code:
Server error log
XF\Db\Exception: User 'my_databese' has exceeded the 'max_user_connections' resource (current value: 30) src/XF/Db/Mysqli/Adapter.php:165
Generated by: Unknown account Jan 19, 2023 at 6:17 AM

Code:
Stack trace
#0 src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array)
#1 src/XF/Db/AbstractAdapter.php(62): XF\Db\Mysqli\Adapter->getConnection()
#2 src/XF/Db/Mysqli/Adapter.php(113): XF\Db\AbstractAdapter->connect()
#3 src/XF/Db/AbstractAdapter.php(518): XF\Db\Mysqli\Adapter->escapeString('addOnsComposer')
#4 src/XF/Db/AbstractAdapter.php(496): XF\Db\AbstractAdapter->quote('addOnsComposer')
#5 src/XF/DataRegistry.php(139): XF\Db\AbstractAdapter->quote(Array)
#6 src/XF/DataRegistry.php(84): XF\DataRegistry->readFromDb(Array, Array)
#7 src/XF/DataRegistry.php(228): XF\DataRegistry->get(Array)
#8 src/XF/App.php(1927): XF\DataRegistry->offsetGet('addOnsComposer')
#9 src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container))
#10 src/XF/App.php(2456): XF\Container->offsetGet('addon.composer')
#11 src/XF/App.php(2026): XF\App->setupAddOnComposerAutoload()
#12 src/XF/Pub/App.php(94): XF\App->setup(Array)
#13 src/XF.php(497): XF\Pub\App->setup(Array)
#14 css.php(8): XF::setupApp('XF\\Pub\\App', Array)
#15 {main}

Code:
Request state
array(4) {
  ["url"] => string(286) "/css.php?css=public%3Abb_code.less%2Cpublic%3Aeditor.less%2Cpublic%3Amessage.less%2Cpublic%3Anotices.less%2Cpublic%3Ashare_controls.less%2Cpublic%3Asimilar_threads.less%2Cpublic%3Astructured_list.less%2Cpublic%3Aextra.less&s=3&l=2&d=1674051399&k=cb528016790c4574f71b37cd28f01985a75b78a4"
  ["referrer"] => string(100) "URL"
  ["_GET"] => array(5) {
    ["css"] => string(179) "public:bb_code.less,public:editor.less,public:message.less,public:notices.less,public:share_controls.less,public:similar_threads.less,public:structured_list.less,public:extra.less"
    ["s"] => string(1) "3"
    ["l"] => string(1) "2"
    ["d"] => string(10) "1674051399"
    ["k"] => string(40) "cb528016790c4574f71b37cd28f01985a75b78a4"
  }
  ["_POST"] => array(0) {
  }
}

I contacted my host and they suggested running the following query:
Code:
mysql DB_NAME -u DB_USER -p’DB_PASS’ -e ‘ALTER TABLE `table_name` ENGINE=`INNODB`;’

Here is their response regarding the query:
This error may occur if the database uses the MyISAM engine which has a limit for connections. If the database gets/sends many requests, it is better to move to the InnoDB engine instead as it is more reliable for multiple connections. You can move to InnoDB by entering the following command in your Shell terminal:

I would like to ask for your advice on whether it is safe to run this query on my database, and if so, would you recommend it?
In any case, what can I do to resolve the errors that are occurring?

Thank you
 
So, I don't have to alter any tables and increase the connection limit instead? Do you confirm?
That limitation is ENTIRELY on your hosting provider... it has nothing to do with the XF database or file structures.
In a nutshell... what is happening is you are getting MORE traffic than your hosting plan supports... so it simply won't accept more than XX number of connections. Generally, if this is a recurring problem.. .it's time to upgrade to a larger hosting package (if on shared) or go to a decent VPS where you control those settings within what your VPS/dedi can support.
 
Yes, just increase the max connections limit in php.in and then restart apache. I am assuming that is what you use.
Sorry, but that's IMHO nonsense:
  1. max_user_connections is a MySQL server setting - it can't be changed through php.ini
  2. He seems to use web hosting, not a VPS or dedicated server - he most likely doesn't have access to restart services
  3. I'd assume that most web hosting companies by now use nginx or LWS / OpenLiteSpeed to serve PHP, but not Apache
@Miri
css.php can put quite some load on the database, especially when upgrading XenForo or Add-ons or working on Styles.
If you can, I'd duggest to enable a cache (Redis or Memcached), this will (significantly) reduce database load.
If this is not possible - get another hosting provider, a bigger plan or a VPS.
 
Last edited:
Thank you @Brogan for reassuring me with your official response.
Thank you, @Richieboy67 @Kirby and @Tracy Perry for your advice.

I am on a shared hosting and I am happy with it and have no intention of changing. The error messages I am receiving are actually 6 and they have never appeared before. Additionally, the time they were generated was early in the morning (around 6:00), which is very strange for my forum because:
  1. I have modest traffic and there isn't much congestion on my forum (200-300 unique visits a day)
  2. Peak traffic usually occurs after noon.
  3. I fear it may be related to the recent increase in spamming.
My shared hosting allows me to choose the version of php I prefer, select php extensions, and edit the php.ini file. I must admit, I thought the "max_user_connections" limit was a variable in the php.ini file but it seems I was mistaken. Unfortunately, "Redis or Memcached" is not supported on my shared hosting plan.

I was looking at the prices for "VPS Hosting" and "Dedicated Server" plans and I have to say, there is a significant difference in terms of money compared to shared hosting. Yes, you will have more resources at your disposal but the monthly cost becomes a significant commitment.

Maybe it's something I will have to consider in the future, we'll see.
 
I am on a shared hosting and I am happy with it and have no intention of changing.
My advice would be to switch hosts.

There are many others who offer cheap, shared hosting without the limitation you have now.

I was paying less than $20 a month for shared hosting with XFES support and cPanel.
 
I have modest traffic and there isn't much congestion on my forum (200-300 unique visits a day)
Your site may be getting hit with the current spam bot that's running around.. which would kick up your normal visitor account and if they are trying to use their breached data accounts to log in would increase the number of mySQL connections needed.
Not saying this is the issue...
There are max connections for both PHP processor and the mySQL backend.

I was looking at the prices for "VPS Hosting" and "Dedicated Server" plans and I have to say, there is a significant difference in terms of money compared to shared hosting. Yes, you will have more resources at your disposal but the monthly cost becomes a significant commitment.

I'm currently hosting with Hetzner... and for a 4vCPU/8GB RAM/160GB SSD storage VPS I pay around $16 a month. This is WELL more VPS than I currently need...but I didn't want to have to go through the hassle of upgrading later and it allows me to do a little more with it.
I run AlmaLinux as the OS on it and CentMin Mod for the LAMP stack.
 
My advice would be to switch hosts.

There are many others who offer cheap, shared hosting without the limitation you have now.

I was paying less than $20 a month for shared hosting with XFES support and cPanel.
I understand, it's not appropriate to ask, and as you mentioned in your message "people don't like to give out too much information."... wait... oh my god... now I get what you meant... :oops:

No worries though, I'm not one of those people who would ask for host names to evaluate. They're so annoying... :sneaky:
 
Back
Top Bottom