We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36760
    • 136 Posts
    After having not made any major updates to a site in about a month (I added ~6 pages, but no new Extras, Snippets, or other Elements), I added a new MIGXdb yesterday and started noticing several 500 errors in the Chrome Console when parts of the manager wouldn't load. Sometimes it's just the document tree, sometimes it's the entire page except the top menu bar, etc. Below are the errors:

    From the Chrome Console:
    POST https://www.dvorakgaming.com/connectors/index.php?action=resource/getNodes&id=root 500 ()
    modx.window.js:60 Uncaught TypeError: this.mask.addClass is not a function
        at S.onShow (modx.window.js:60)
        at S.afterShow (ext-all.js:21)
        at S.show (ext-all.js:21)
        at Object.show (ext-all.js:21)
        at MODx.onAjaxException (modx.js?v=f4060b11:122)
        at h.Event.fire (ext-all.js:21)
        at Ext.data.Connection.fireEvent (ext-all.js:21)
        at Ext.data.Connection.handleFailure (ext-all.js:21)
        at f (ext-base.js:21)
        at m (ext-base.js:21)

    The exact error varies, but the first one is always related to index.php in the connectors folder.

    From the cPanel Errors page:
    [Wed Dec 21 21:28:41.292995 2016] [:error] [pid 923587] (12)Cannot allocate memory: [client *removed IP*] couldn't create child process: /opt/suphp/sbin/suphp for /home/dvgaming/public_html/index.php, referer: https://www.dvorakgaming.com/manager/
    [Wed Dec 21 21:28:41.289561 2016] [:error] [pid 923587] (12)Cannot allocate memory: [client *removed IP*] couldn't create child process: /opt/suphp/sbin/suphp for /home/dvgaming/public_html/connectors/index.php, referer: https://www.dvorakgaming.com/manager/
    [Wed Dec 21 21:28:35.873411 2016] [:error] [pid 923598] (12)Cannot allocate memory: [client *removed IP*] couldn't create child process: /opt/suphp/sbin/suphp for /home/dvgaming/public_html/index.php, referer: https://www.dvorakgaming.com/manager/
    [Wed Dec 21 21:28:35.870406 2016] [:error] [pid 923598] (12)Cannot allocate memory: [client *removed IP*] couldn't create child process: /opt/suphp/sbin/suphp for /home/dvgaming/public_html/connectors/modx.config.js.php, referer: https://www.dvorakgaming.com/manager/



    I've tried several things to solve the issue, but nothing seems to work, details below. Most of these ideas are from other threads with similar issues.

    1. Removed the MIGXdb I created, including everything from the core/components folder and the database table
    2. Upgraded from 2.5.1 to 2.5.2
    3. Disabled all Extras via the database by setting the "disabled" column to "1"
    4. Verified all of the connectors files exist and are accessible, they have 644 permissions set and changing the permissions didn't seem to affect anything
    5. After each item above I cleared my browser's cache as well as deleted the contents of the core/cache folder

    Some more details about my installation:

    • I've renamed the manager, assets, and connectors folders (I changed their names back in this post to hopefully help maintain security)
    • The core folder was also renamed and is located outside the public_html folder
    • When upgrading with the Advanced Install I would download the zip from modx.com, rename the core folder, upload it to the correct location on my server, unzip it in place and overwrite the current core folder, upload the setup folder to public_html, access the setup folder and follow the instructions. Nothing indicated anything went wrong during any updates, but I thought I would include these steps incase I did something wrong.
    • The site has been running smoothly for ~4 months prior to this, and nothing indicates it's been hacked outside of this issue.
    • The site is also run through CloudFlare, but has been for ~3 months without any issue. I have a Page Rule in place that excludes the manager from their caching.

    And finally, some details about the server itself.

    cPanel Version - 60.0 (build 28)
    Apache Version - 2.4.23
    PHP Version - 5.6.23
    MySQL Version - 5.6.34
    Architecture - x86_64
    Operating System - linux
    Virtual and Physical Memory - 1GB
    Memory allocated to PHP - 128MB

    All resources are at near-0% utilization until I access the manager, at which point the memory usage jumps to 100% (as expected based on the errors). As far as I can tell, my host hasn't changed my resource allocations. I've always had 1GB of RAM and 128MB allocated to PHP.

    I appreciate any help and additional troubleshooting I can try!

    This question has been answered by firebot6. See the first response.

      • 36760
      • 136 Posts
      Following up with a couple more things I checked.

      1) I only have one Extra/Plugin that was using the OnPageNotFound event, I went ahead and disabled it, but that didn't help.
      2) As far as I know I have no looping chunks/snippets/etc, I only updated three elements in the last month and none of those contain a loop.

      I've also sent a ticket into my host to see if they can provide any new information and verify it isn't something on their end.
      • The error seems to indicate that your server is running out of memory. The manager can be pretty heavy with all the simultaneous ajax requests, but you might just be due for upgrading to a bigger server.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 33448
          • 9 Posts
          Some Information from my problem this morning. Maybe some relevance.
          I don't know to check console and stuff but I though I was having memory allotment problems.

          - Most of my entry to support ticket to host:
          ===
          Maybe modx in xxxxxxxx.org is running out of memory.?
          Using the modx console - emptying the cache just hangs & never completes.
          If I FTP in and delete some cache files - the modx console will work for the remaining.
          I also appears that some tables aren't being created in the modx database.
          Can you give me memory or check it out what else might be happening?
          --
          Then:
          ===
          Sorry allow me to give you more information. This is a new development site.
          It was working fine at the beginning. First I had a problem deleting cache from within modx, the modx console run but not complete, I deleted the cache through FTP.
          As the site was added to I started having some pages not saving. the indication was that the saving dialog would keep repeating it's animation & not end. So I was adding or making changes though phpmyadmin.
          Now the most recent "Template Variable " (TV) I created is not creating fields in all of the ID fields in the database, so that I can't even add the edits in phpmyadmin & when trying from the interface the saving dialog loops and does not complete.
          I tried remove a TV in the modx interface and re-adding it but to no avail.
          This has started happening as more content, chunks and template variables were added to the pages.
          This is what has me question the memory usage.
          =====
          Server Tech answered:
          ===
          On checking we could see that some modsecurity rules were triggering for the domain and I have whitelisted the domain against the modsecurity now.
          ===
          I had modsecurity issues when I first installed. I couldn't install any packages. Tech made changes to modsecurity then. So I'm not sure if today modsecurity change is new or different.
          • Zenfort, is that related to the problem firebot6 posted about? It sounds like you may have replied to the wrong post, or meant to start a new topic?
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 36760
              • 136 Posts
              Quote from: markh at Dec 22, 2016, 10:29 AM
              The error seems to indicate that your server is running out of memory. The manager can be pretty heavy with all the simultaneous ajax requests, but you might just be due for upgrading to a bigger server.

              I was talking with my host and they said they can raise the memory limit, but that it was unusual for it to be using more than 1GB of Virtual Memory. Is that true even with Modx? I've honestly never had to delve this deep into memory usage before. The site has ~100 pages, and probably just as many Elements (chunks/template variables/etc), along with four MIGXdbs. If you still think I need more memory, do you think 2GB would be enough?

              Thanks for the help!
                • 36760
                • 136 Posts
                Still working on collecting information on this. Just to verify that it's only the manager area that's having the issue, I turned off all CloudFlare caching and loaded the front-end of the site directly. The CPU and Physical/Virtual Memory usages never passed ~5% for memory or ~15% for CPU. I was actually kind of hoping I'd find the issue on one of the pages to narrow down what Element might be to blame!

                I'm waiting on the host to raise my memory to 2GB, hopefully that just solves it.

                Is it possible something is corrupt in the manager files, would trying another re-install be beneficial?
                  • 3749
                  • 24,544 Posts
                  Is it possible that you have a circular reference somewhere? An example would be two chunks that each contain tags for the other chunk. That will eat up memory in a hurry.

                  A getResources call that displays the content field of aggregated resources, one of which has a getResources call that includes the other page would also do it.

                  It could also be an extra with a memory leak.

                  You could try a plugin attached to OnManagerPageAfterRender and OnWebPageComplete with code something like this to log the memory usage:

                  $location = $modx->context->get('key');
                  $realUsage = true; // also try false here
                  
                  function format_memory_usage($value) { 
                      if ($value < 1024) {
                          $usage =  $value." bytes"; 
                      } elseif ($value < 1048576) {
                          $usage = round($value/1024,2)." kilobytes"; 
                      } else  {
                          $usage = round($value/1048576,2)." megabytes"; 
                      }
                      return $usage;
                  } 
                  
                  $m = format_memory_usage(memory_get_usage($realUsage));
                  $p = format_memory_usage(memory_get_peak_usage($realUsage));
                  $limit = ini_get('memory_limit');
                  
                  $msg = '[' . $location . '] ' . 'CURRENT: ' . $m . ' -- PEAK: ' . $p . ' -- LIMIT: ' . $limit;
                  $modx->log(modX::LOG_LEVEL_ERROR, $msg);
                  return;
                  



                  It's unlikely that the problem is in the core files, but it can't hurt to re-run setup. You can also use the UpgradeMODX extra to "upgrade" to the current version if you change the value of the current version property of the widget snippet back to the previous version. UGM will download and install all new MODX files, delete all files in the core/cache directory, and launch setup. [ed. note: BobRay last edited this post 7 years, 4 months ago.]
                    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
                    • 36760
                    • 136 Posts
                    I don't believe I would have a circular reference anywhere. I went back through the few chunks I edited before this started happening and I don't see anything like that. I also checked on the pages I had added, but didn't see anything either. I don't currently have any getResources calls on the site that I remember, definitely none that I've changed recently. I looked through my database, and I did have some getResources calls, but they seem to be in working order still.

                    This is probably a dumb question, but could an extra somehow develop a memory leak? I haven't installed any new ones, but I did re-install several of them thinking maybe something just became corrupted or wasn't compatible with 2.5.2. I'll power my way through re-installing all of them and making sure any I'm not using are removed.

                    Here are the results of your plugin:

                    realUsage set to true
                    [2016-12-23 01:26:33] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 6.5 megabytes -- PEAK: 6.75 megabytes -- LIMIT: 512M
                    [2016-12-23 01:26:44] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 7.75 megabytes -- PEAK: 7.75 megabytes -- LIMIT: 512M
                    [2016-12-23 01:26:48] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 6.25 megabytes -- PEAK: 6.5 megabytes -- LIMIT: 512M
                    [2016-12-23 01:26:50] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 6.25 megabytes -- PEAK: 6.5 megabytes -- LIMIT: 512M


                    realUsage set to false
                    [2016-12-23 01:35:28] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 7.75 megabytes -- PEAK: 7.75 megabytes -- LIMIT: 512M
                    [2016-12-23 01:35:34] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 9.75 megabytes -- PEAK: 9.75 megabytes -- LIMIT: 512M
                    [2016-12-23 01:35:41] (ERROR @ /home/name/core/cache/includes/elements/modplugin/10.include.cache.php : 21) [mgr] CURRENT: 6.25 megabytes -- PEAK: 6.25 megabytes -- LIMIT: 512M


                    Unless my abbreviation knowledge is off, the manager is actually using significantly less than what I have allocated?

                    I also went ahead and did another fresh install of 2.5.2, making sure to completely replace my core, manager, and connectors folders with fresh ones (besides the config and extras files), but it didn't seem to change anything. [ed. note: firebot6 last edited this post 7 years, 4 months ago.]
                    • If the server is out of memory that doesn't necessarily mean this particular site/user on the server is the one causing the memory to be full - you mentioned cpanel, so my thought was you might have other sites pooling from the same available memory.

                      You can most definitely run MODX with less than 1GB ram; I have a 2GB VPS with about a dozen sites on it, and the main reason that was last upgraded to 2GB is the nightly backups slowing things down too much. Also have a bunch of other sites on simple shared/reseller plans.
                        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.