• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 'Too Many Connections' Errors

#1
My forum is experiencing numerous server errors and I’m not sure why. I can’t find any pattern to when they occur and overall traffic on the site isn’t excessive (under 450 per day). The majority of them are “Too many connections” errors. The URL is different for each of the errors. The other error message is “max users connections.” I've contacted my host and they said there's nothing they can do to resolve the issue and have no idea why it is happening. The error logs are below:



Error Info

Zend_Db_Adapter_Mysqli_Exception: Too many connections - library/Zend/Db/Adapter/Mysqli.php:333

Generated By: Unknown Account, 19 minutes ago

Stack Trace

#0 /home/mitchel56/public_html/community/library/Zend/Db/Adapter/Abstract.php(315): Zend_Db_Adapter_Mysqli->_connect()
#1 /home/mitchel56/public_html/community/library/XenForo/Application.php(727): Zend_Db_Adapter_Abstract->getConnection()
#2 [internal function]: XenForo_Application->loadDb(Object(Zend_Config))
#3 /home/mitchel56/public_html/community/library/XenForo/Application.php(970): call_user_func_array(Array, Array)
#4 /home/mitchel56/public_html/community/library/XenForo/Application.php(1001): XenForo_Application->lazyLoad('db', NULL)
#5 /home/mitchel56/public_html/community/library/XenForo/Application.php(1571): XenForo_Application::get('db')
#6 /home/mitchel56/public_html/community/library/XenForo/Model.php(161): XenForo_Application::getDb()
#7 /home/mitchel56/public_html/community/library/XenForo/Model/DataRegistry.php(138): XenForo_Model->_getDb()
#8 /home/mitchel56/public_html/community/library/XenForo/Model/DataRegistry.php(97): XenForo_Model_DataRegistry->_getMultiFromDb(Array)
#9 /home/mitchel56/public_html/community/library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
#10 /home/mitchel56/public_html/community/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#11 /home/mitchel56/public_html/community/index.php(13): XenForo_FrontController->run()
#12 {main}
Request State

array(3) {
["url"] => string(57) "…/community/find-new/134757/posts"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}












Zend_Db_Adapter_Mysqli_Exception: User mitchel56_xfad already has more than 'max_user_connections' active connections - library/Zend/Db/Adapter/Mysqli.php:333

Generated By: Unknown Account, Friday at 4:32 AM

Stack Trace

#0 /home/mitchel56/public_html/community/library/Zend/Db/Adapter/Abstract.php(315): Zend_Db_Adapter_Mysqli->_connect()
#1 /home/mitchel56/public_html/community/library/XenForo/Application.php(727): Zend_Db_Adapter_Abstract->getConnection()
#2 [internal function]: XenForo_Application->loadDb(Object(Zend_Config))
#3 /home/mitchel56/public_html/community/library/XenForo/Application.php(970): call_user_func_array(Array, Array)
#4 /home/mitchel56/public_html/community/library/XenForo/Application.php(1001): XenForo_Application->lazyLoad('db', NULL)
#5 /home/mitchel56/public_html/community/library/XenForo/Application.php(1571): XenForo_Application::get('db')
#6 /home/mitchel56/public_html/community/library/XenForo/Model.php(161): XenForo_Application::getDb()
#7 /home/mitchel56/public_html/community/library/XenForo/Model/DataRegistry.php(138): XenForo_Model->_getDb()
#8 /home/mitchel56/public_html/community/library/XenForo/Model/DataRegistry.php(97): XenForo_Model_DataRegistry->_getMultiFromDb(Array)
#9 /home/mitchel56/public_html/community/library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
#10 /home/mitchel56/public_html/community/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#11 /home/mitchel56/public_html/community/index.php(13): XenForo_FrontController->run()
#12 {main}
Request State

array(3) {
["url"] => string(85) "…community/threads/3844/data/avatars/m/1/1656.jpg?1425214554"
["_GET"] => array(1) {
[1425214554] => string(0) ""
}
["_POST"] => array(0) {
}
}
 
#6
While I'm still planning to switch hosts, I just ran the File Health Check and it generated the following report. Might this be related to my other issues, since some of the paths are the same within the different errors?


An exception occurred: Mysqli prepare error: MySQL server has gone away in /home/mitchel56/public_html/community/library/Zend/Db/Statement/Mysqli.php on line 77

  1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
  2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
  3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
  4. Zend_Db_Adapter_Abstract->query() in XenForo/Model.php at line 219
  5. XenForo_Model->fetchAllKeyed() in XenForo/Model/AdminNavigation.php at line 31
  6. XenForo_Model_AdminNavigation->getAdminNavigationEntries() in XenForo/Model/AdminNavigation.php at line 405
  7. XenForo_Model_AdminNavigation->getAdminNavigationForDisplay() in XenForo/Dependencies/Admin.php at line 224
  8. XenForo_Dependencies_Admin->_getNavigationContainerParams() in XenForo/Dependencies/Admin.php at line 202
  9. XenForo_Dependencies_Admin->getEffectiveContainerParams() in XenForo/FrontController.php at line 616
  10. XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
  11. XenForo_FrontController->run() in /home/mitchel56/public_html/community/admin.php at line 13
 

Tracy Perry

Well-known member
#9
The issue is that you are apparently on a shared host that limits the number of concurrent mysql connections (most likely to around 25) and between your REAL visitors and the bots/guests hitting your site you are exceeding that allocation. The only resolution is
1) Grab a larger hosting package from your current provider that allows more concurrent mysql connections
2) change hosts to one that allows more concurrent mysql connections
3) obtain a VPS and control the mysql connections yourself
4) obtain a dedicated server and do the same as #3
 

rwm1962

Active member
#14
100. I asked for it to be increased but I didn't specify by how much. We block all but a few legit bots & it's likley the ones we do allow that caused our problem by being a little overzealous.
 

Tracy Perry

Well-known member
#15
100. I asked for it to be increased but I didn't specify by how much. We block all but a few legit bots & it's likley the ones we do allow that caused our problem by being a little overzealous.
I would have tried around 300-400 to start with.... the more connections you assign, the higher the memory footprint - and if you don't need 1000, you are basically wasting memory.
 
#17
The issue is that you are apparently on a shared host that limits the number of concurrent mysql connections (most likely to around 25) and between your REAL visitors and the bots/guests hitting your site you are exceeding that allocation. The only resolution is
1) Grab a larger hosting package from your current provider that allows more concurrent mysql connections
2) change hosts to one that allows more concurrent mysql connections
3) obtain a VPS and control the mysql connections yourself
4) obtain a dedicated server and do the same as #3
I am using VPS, how to control the mysql connections myself to resolve this issue?