We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50272
    • 89 Posts
    Hi Folks

    I've just got notification of a massive server error log (36mb) which consisted
    of reams and reams of errors inside a twenty minute period.
    The MODX manager was kind of flashing and I couldn't do anything until
    I cleared out the core/cache.

    The errors typically looked like this:

    [2017-10-04 12:36:10] (ERROR @ /home/geo10000/core-chapelchoir/xpdo/om/xpdoobject.class.php : 1452) Error HY000 executing statement:
    INSERT INTO `modx_session` (`id`, `access`, `data`) VALUES ('3tjlh3gou657ieg9judsgskqn1', 1507116970, 'modx.user.contextTokens|a:0:{}modx.user.0.resourceGroups|a:1:{s:3:\"web\";a:0:{}}modx.user.0.attributes|a:1:{s:3:\"web\";a:5:{s:16:\"modAccessContext\";a:1:{s:3:\"web\";a:1:{i:0;a:3:{s:9:\"principal\";i:0;s:9:\"authority\";s:1:\"0\";s:6:\"policy\";a:1:{s:4:\"load\";b:1;}}}}s:22:\"modAccessResourceGroup\";a:0:{}s:17:\"modAccessCategory\";a:0:{}s:28:\"sources.modAccessMediaSource\";a:0:{}s:18:\"modAccessNamespace\";a:0:{}}}')
    Array
    (
        [0] => HY000
        [1] => 2006
        [2] => MySQL server has gone away
    )


    Those last three array entries were consistent throughout.

    The Manager's error log was clear.

    I've learned this may be a MySQL db connection issue.

    Has anyone got any thoughts on this?

    This project is destined for the bin at this rate.

    I do appreciate people's time
    Chris


    My setup:
    MODX latest (2.5.8)
    MAMP (3.4)
    PHP (5.6.10)
    MySQL (5.5.42)
    Chrome: Std and Canary (latest versions)
    MacOS Sierra 10.12.6
      • 3749
      • 24,544 Posts
      You're host's server could just be overloaded, especially if you're on a shared server. I think that's the most likely cause. Possibly someone else on the server is putting a very heavy load on it.

      You host may also limit the number of DB calls made in a certain time period.

      Are you running a DB-intensive script, or is this just from working in the Manager?

      If it's a script, there may be things you could do to cut down the number of DB queries or their frequency.

      If it's just the MODX Manager, you might ask your host for help (they could put you on another server, or kick off whoever is causing the problem).

      I've never seen that on any of these hosts: https://bobsguides.com/modx-friendly-hosts.html, which are able to handle the many queries generated by the Manager. A2 and SkyToaster are particularly good with MODX. If your host is owned by EIG, I'd strongly recommend switching (see the box on the page in the link).
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 50272
        • 89 Posts
        Hi Bob

        Thanks for such a considered response

        Yes, only whilst working in the manager.
        Incidentally, I'm using the following Extras: Ace, Format, if, Login, Migx, seopro, sitecheck, seoTab, upgradeModx and Wayfinder.
        I ran Sitecheck which found no errors.
        I've also repaired and optimised the db tables, seemingly without issue.

        It seems judging by that twenty minutes of looping as far as I can make out, I think I was the one putting the heavy load on the server.
        Does the 'Error HY000 executing statement:' reference mean anything to yourself?
        If I go to 'www.site/manager' I can login without problems as you'd expect.
        If I go directly to 'www.site' Boom! the CPU Usage max's out.

        I received this reply from my host (krystal.co.uk - who thankfully aren't EIG fodder), to be fair, have been very accommodating and as helpful as possible.

        This is more along the lines of ModX having a melt down when running it's backend checks or tool runs, Sadly it is looking like it's the MODX Lib:

        xpdoobject.class.php
        On line 543, so whatever it's calling is failing.

        Saying that, it could be dropping out when whatever is executed on that line is topping SQL query limits, although I can't see that this end.

        I attach a screen grab from 'xpdoobject.class.php' showing the appropriate lines

        No longer sure how to proceed with this.

        Thank you



        ps. tried attaching the screenshot, but looks like that's failed.

        I realise it's out of context but here is line 543.

          
        $xpdo->log(xPDO::LOG_LEVEL_ERROR, "Error {$query->stmt->errorCode()} executing query: {$query->sql} - " . print_r($query->stmt->errorInfo(), true));
        


        pps. when going directly to 'www.site' I'm now getting this...


        The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.

        I've checked and that all seems to be kosher.

        Where do you go with this stuff? (rhetorical)

        Apologies for War and Peace Bob [ed. note: geordiechris last edited this post 6 years, 6 months ago.]
          • 3749
          • 24,544 Posts
          HY000 is a general error code used when no error code is obtained from MySQL (which would figure if there's no connection to the DB), with the following text describing the error.

          Screenshots don't work in the Forum any more. You have to put the image somewhere and put a link to it.

          I can't make any sense of the character set warning if SiteCheck doesn't report a mismatch, unless one of your extras is creating a table with a different prefix. I'm not sure if SiteCheck checks those or not. You might look in the DB for tables with a different prefix and check the character set and collation of the those tables and any text fields in them. I've had extras create latin1 tables. See this if there's a mismatch: https://bobsguides.com/convert-db-utf8.html.

          A character set error could be causing the problem. It seems unlikely, but the problem should be fixed anyway if it exists.

          While you're there, look for any tables that shouldn't be there, in case the site has been hacked. I'd also take a look at the index.php files in the root and Manager and look in the modx_site_plugins table for any plugins that you didn't install. Also, check the Users table for any users that shouldn't be there.

          The error from line 543 would probably come from no connection to the DB server since it appears to be calling the SQL engine.

          You may have a circular reference somewhere, but that's unusual in the Manager. Make sure the page specified in the error_page System Setting is published.

          Since it's happening in the Manager, I'd try disabling any plugins connected to Manager events.

          Something else to try is watching the Network tab in Chrome Dev. Tools (Ctrl-shift-i), to see if you can see any looping.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 50272
            • 89 Posts
            Ok Bob, I've checked the db for rogue tables or char set/collation issues.
            Incidentally on that subject, I have on a few occasions:
            Created a db.
            Gone into phpMyadmin and altered its char set/collation to the necessary.
            Yet sometimes during installation, MODX has failed to register that
            change and I have to reselect at that point.
            That said, I'm dubious as to that being the problem here.

            It seems there are no unwelcome prefixes, plugins or indeed users.

            When you say...
            ...take a look at the index.php files in the root and Manager...
            what exactly would I be looking for?
            I've done a simple, line-by-line comparison with that of corresponding files of working sites,
            but without joy.

            However, on the subject of index files and on the back of your suggestion of studying the
            Dev Tools Network pane, (I had been using this, but not with the idea of looping in mind)
            I did spot something...

            After uploading 'setup' and running through the process,
            and at the point of clicking 'Login', the following showed up...

            Request URL: http://mysite.co.uk/setup/index.php?action=complete
            Request method: POST
            Status code: 302 Found 
            
            Request URL: http://mysite.co.uk/setup/index.php?action=login
            Request method: GET
            Status code: 302 Found 


            And at this point my hosting CPU Usage simultaneously blasted off to Mars!

            Forgive me if this is usual activity, but it seems like the makings of a 'circular reference' to me.
            Of course I checked too for duplicate index files.

            I also checked the error_page System Setting is published.

            On the subject of...
            ...disabling any plugins connected to Manager events.
            I have done some reading on the subject (the sparse amount I could find),
            but not too much wiser I'm afraid.

            But I will continue to tinker...

            Many thanks once more

            [ed. note: geordiechris last edited this post 6 years, 6 months ago.]
              • 3749
              • 24,544 Posts
              I had another thought. When you had this trouble in the Manager, were you by chance previewing pages in the front end?

              I was thinking that this was strictly a Manager issue, but if you were looking at the front end, maybe not.

              Circular references most often come from something like a getResources call that includes the content of the page with the getResources tag in the results. The tag could also be in the page Template. This could also happen in a sitemap or Wayfinder call, but that's less likely.

              A weblink or Symlink which has its own page as the reference would also do it.

              Another possibility, if you've modified .htaccess, is a rewrite rule that sends the user back to the same page over and over.

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 50272
                • 89 Posts
                Hi Bob

                Well, I tried resolving things with your kind input and other related threads, but sadly to no avail.
                Yes, I was looking at pages in the front end as I went.
                And no, I hadn't touched .htaccess

                I rebuilt the site (third time) with a more radical, bare-bones mindset to try and avoid things like circular references and general complexity.
                All going very well...
                until I tried to clear my browser cache (latest Chrome using the 'Clear Cache 1.1.2' extension) on my LOCAL machine...
                and Boom! the CPU on my REMOTE cPanel spikes to 100%!
                How is that even possible?
                And then it becomes impossible to load the site directly in any browser i.e. 'mysite.com'.
                I have to leapfrog into the manager to gain access agian i.e. 'mysite.com/manager'.
                And an hour later, this is still the case.
                Obviously I've also asked my host the necessary questions,
                but this is beyond me.

                Need to win The Lotto...

                Many Thanks

                ps

                just found this in my remote server error log...(simply repeated as seen, 3,600 times inside ten seconds)

                [2017-10-09 14:42:19] (ERROR @ /home/geo10000/public_html/mysite.com/core/xpdo/xpdo.class.php : 1247) Problem getting service redirector, instance of class Redirector, from path /home/geo10000/public_html/mysite.com/core/components/redirector/model/redirector/
                [2017-10-09 14:42:19] (ERROR @ /home/geo10000/public_html/mysite.com/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector.


                I've uninstalled and removed Redirector, but the error seems to persist.
                Perhaps residual entries in the Db that need clearing out?
                [ed. note: geordiechris last edited this post 6 years, 6 months ago.]
                  • 3749
                  • 24,544 Posts
                  Perhaps residual entries in the Db that need clearing out?

                  Possibly, but try manually deleting all files in the core/cache directory first. Plugins are often zombie-like.

                  That thing with the Chrome extension is really weird.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting