We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29635
    • 361 Posts
    Anybody ever seen the "Too many connections" error in MODx?


    (Full size image here: http://themancan.com/dropbox/MODx%20error%20page.png )

    The server admin is telling me to optimize the database calls. I have the pages set to cache, so I’m curious what the issue could be. It only happens occasionally, but it’s obviously bad when it does happen.

    Perhaps on a related note: If a snipet is called uncached (like this [! !]) does that mean the page doesn’t get cached?

    Any ideas? Thanks for any help.
    Brett

    EDIT: I found this (http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html) if anybody’s interested.
    The site in question doesn’t have anything special going on with persistent connections, and the MODx stats are disabled, though I do have SlimStat installed and running. Not sure if that would create a problem
      Need MODx Ecommerce? Try FoxyCart!
      • 25663 MODX Staff
      • 12,272 Posts
      Stats will definitely increase your DB load. As will some dynamic menu builders and newslisting / ditto calls if not crafted carefullly.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 22303 MODX Staff
        • 10,725 Posts
        This typically only happens if all the mysql resources on the server are being used, i.e. there are no available connections. And unless your site is seeing a huge proportion of the traffic compared to other applications on the same server, I don’t believe they can blame MODx for this issue.
          • 22815
          • 1,097 Posts
          Your server admin is essentially telling you to make less db calls because he’s spreading MySQL very thinly across a lot of people (or someone else on the server is running something particularly connection-heavy). This is particularly scary given that you are barely using the db - although even a cached page calls the db to find out which cached page to load, because they are stored by ID not by alias - eg "5" not "traditions".

          I note that your error is from a manager page.

          It is entirely possible that a wrong URL in Manager session-handling code is causing your 404 page to be generated every time you use the Manager.

          Having poked around at your site www.jazzizradio.com (which is very nice, btw) I can see that you have your Error page (aka 404 page) set to the same as the home document. This contains a number of presumably uncached elements - the 3 radio station "now playing" update frequently. From my understanding of the parser, a cached document with uncached elements is loaded, and then the uncached elements are generated and substituted into placeholders. So this page is quite db heavy, even if it’s not loading anything different from the db each time.

          Even without this manager bug, you really do not want to have your Error page point to such a heavy homepage!! You should definitely change that. (It’s down as "Error page" in Administration: System Configuration).

          The "will end up loading 404 page" side-effect of the bug was pointed out just today by sottwell.

          To stop unnecessary loading of the 404 page every time you load the manager:

          Quote from: Bravado at May 24, 2006, 07:21 AM

          .. go to /manager/frames/1.php, change line 18 to this:
          	<script language="JavaScript" src="media/script/session.js"></script>

            No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 29635
            • 361 Posts
            Thanks very much for all the tips. I’m still trying to get the max connections setting from the admin, but...

            @OpenGeek, @Ryan: The site’s actually on it’s own dedicated (and managed) box (that I don’t control), and MODx (with SlimStat) is the only thing running. That said, the site’s getting about 140,000 hits a day, which is significantly higher than any other site I’ve done. (The huge majority of those hits are from the pages that load in Windows Media Player, refresh every 90 seconds for the baner ads.)

            SlimStat takes forever to load now. I’ve just disabled it because the site’s got AWStats and Urchin/Google anyway. SlimStat is so nice and fast usually. Maybe not with such massive numbers. I’m guessing the issue was with SlimStat and not necessarily MODx.

            @Paul: It’s not generating the error every time, just occasionally. Thanks for the tip and the compliment. I’ll change the error page per your recommendation.

            Thanks all. I’ll update if I ever hear back from the admin. I hate using other people’s servers wink I never have these issues on the servers I manage.
              Need MODx Ecommerce? Try FoxyCart!
              • 25663 MODX Staff
              • 12,272 Posts
              check out the size on that slimstats databse... i bet it’s huge, and likely the source of the problem.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 29635
                • 361 Posts
                Data size: 77MB
                Index size: 290MB

                I think you’re right wink
                Thanks.
                  Need MODx Ecommerce? Try FoxyCart!
                  • 13577
                  • 302 Posts
                  Thought I’d add my experience to the pile on this one in case anyone needs it for reference (like I did).

                  I was getting the same error. It wasn’t a database problem though - my hard drive was at capacity. I literally had years of server log files hanging around that I was able to remove - freeing up several GB and putting our site back in business.

                  And whether it was coincidence or not, the MODx log tables got corrupted and I had to restore them from backups. They had nothing in them because we don’t use MODx for user stats, but I still wanted the tables in tact.

                  Just my $0.02
                    Standard Disclaimer
                    I could be totally wrong.