1. 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

Discussion in 'Troubleshooting and Problems' started by xsteve, Jul 15, 2015.

  1. xsteve

    xsteve New Member

    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) {
    }
    }
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    This is a limitation imposed by your host.

    Contact them and ask them to raise the limit.
     
  3. xsteve

    xsteve New Member

    That's what I thought too, Brogan. The host says they can't raise the limit. Not sure why they're refusing to help.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You should probably consider a new host.
     
    SneakyDave likes this.
  5. xsteve

    xsteve New Member

    That's the plan. Thanks again.
     
  6. xsteve

    xsteve New Member

    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
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Again, it's server related.
     
  8. xsteve

    xsteve New Member

    Okay. Thought I would double check. Thanks.
     
  9. Tracy Perry

    Tracy Perry Well-Known Member

    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
     
  10. rwm1962

    rwm1962 Active Member

    I've had this over a 2 minute period today. I'm going to speak to my host.

    How does this manifest itelf to my users?
     
  11. Mike

    Mike XenForo Developer Staff Member

    Generally as a database error page (likely a mostly unstyled one).
     
  12. rwm1962

    rwm1962 Active Member

    Thanks. Max connections increased to 1000
     
  13. Tracy Perry

    Tracy Perry Well-Known Member

    Uhh... what WAS it at. 1000 is a little high unless you have LOTS of users online.
     
  14. rwm1962

    rwm1962 Active Member

    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.
     
  15. Tracy Perry

    Tracy Perry Well-Known Member

    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.
     
    rwm1962 likes this.
  16. rwm1962

    rwm1962 Active Member

    Thanks for the advice - I'll get them to reduce it to 300.

    Cheers!
     
    Last edited: Jul 31, 2015
  17. xfactormaster

    xfactormaster Member

    I am using VPS, how to control the mysql connections myself to resolve this issue?
     
  18. Tracy Perry

    Tracy Perry Well-Known Member

    edit your my.cnf and change the
    max connections =
    line to reflect more - depending on your vps size - try 50-75 (start at 50).
     

Share This Page