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

XF 1.2 Too many connections?

Discussion in 'XenForo Questions and Support' started by jauburn, Dec 12, 2013.

  1. jauburn

    jauburn Well-Known Member

    I saw about five of these in my server error logs:

    Too many connections 47 minutes ago - library/Zend/Db/Adapter/Mysqli.php:333
    Any idea of what causes this?

  2. Slavik

    Slavik XenForo Moderator Staff Member

    You need to increase your mysql max_connections setting.
    jauburn likes this.
  3. jauburn

    jauburn Well-Known Member

    I did that--or I had the host do that. Here's what the host said, though. I'll pass this along and ask whether you think there's validity to it because it deals mostly with xenforo:

    In terms of MySQL, you have a couple issues. First off, your server is reaching the maximum connection limit. This is caused by code in your site where connections are opened to the MySQL server but never properly closed. This will cause your MySQL server to reject any further connections once it reaches this limit until slots open up. As a result, you'll see errors, slowness, etc.

    The way to correct this is to fix your site code so that any time a connection to MySQL is opened, it is closed properly. The next thing I notice is that you have a lot of "JOIN" queries that take place without the use of indexing. This causes fragmentation, slowness and other issues with databases. It would be advisable, and best practice, to audit your site code and fix it so that any time a JOIN is performed, it is done with indexing. ....

    The code fixes are definitely going to be the most helpful in terms of performance, so I would suggest implementing those as soon as possible. Please let me know if you have any further questions, and how you wish to proceed.

    Are these "code fixes" something that xenforo can do?
  4. Jeremy

    Jeremy Well-Known Member

    The software closes connections properly. The JOIN requests are also perfectly fine, an index isn't necessary or advisable in every instance.
  5. Slavik

    Slavik XenForo Moderator Staff Member

    XenForo already does anything your host is suggesting.

    Some joins are done without index, but as Jeremy pointed out, not all joins require indexes.
  6. jauburn

    jauburn Well-Known Member

    Yeah, I suspected I got some mumbo jumbo from the host, but it was very specific mumbo jumbo, so I wonder what he was seeing?
  7. Mike

    Mike XenForo Developer Staff Member

    You could disable "Enable Delayed Insert SQL Queries" - this causes long connections, though it should generally only be a couple. It's probably what he saw but didn't realize that they're actually internal to MySQL's implementation.

    The join comment is random, especially without an example. (Obviously note that add-ons can add bad queries, bad joins, etc -- this is often where heavy queries appear from.)
  8. jauburn

    jauburn Well-Known Member


    I have quite a long list of add-ons now. How in the world could I figure out which one(s) are the culprit:

    Installed Add-ons
    Ad Manager
    1.0 Beta 3
    Bb Codes & Buttons Manager
    Browser Detection (Mobile/MSIE)
    CTA Featured Threads
    Disable Invisible Status by Waindigo
    Donation Manager
    Find Unanswered Threads
    ForumRunner for XenForo
    Nodes As Tabs
    PhotoPost Integration
    Post As User by Waindigo
    Post Message Regex Replacer
    QuoteME !
    Remove Trophy
    Sitemap for XenForo
    Smilie Importer by Waindigo
    TinyMCE Quattro
    Username change
    XenForo Resource Manager
    [8wayRun.Com] XenAtendo (Events)
    [BBM] BbCode Multimedia - Html5media
    [bd] Widget Framework
    [Extra License] New User Conversation
  9. Brogan

    Brogan XenForo Moderator Staff Member

    Disable them all and re-enable them one at a time, performing checks and tests with each one active.
  10. jauburn

    jauburn Well-Known Member

    Well, I wouldn't even know how to begin performing such checks and tests.
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Clear the server error log.
    Disable all add-ons.
    Enable one add-on and use the forum normally.
    Check for errors.
    If no errors, enable the next add-on and repeat.
  12. snoopy5

    snoopy5 Well-Known Member

    Did you find out which addon caused the problem?

Share This Page