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

    I can see that any of our resources that have a GetResource call throws up this error:
    Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /home/site/public_html/core/xpdo/om/xpdoquery.class.php on line 362


    I've already tried adding some lines to a php.ini file to increase the memory limit but they haven't helped. See my final php.ini file below:
    date.timezone = "Australia/Perth"
    extension=pdo.so
    extension=pdo_sqlite.so
    extension=sqlite.so
    extension=pdo_mysql.so
    session.save_path = /home/site/public_html/sessions/
    session.gc_maxlifetime = 604800
    safe_mode = off
    magic_quotes_gpc = off
    memory_limit = 128M


    Do I have to contact my server provider and request some changes to the server? I've sent them an email anyway to see if they have any idea on how to solve the issue.

    My setup:

    • MODX Version: MODX Revolution 2.2.7-pl (traditional)
    • PHP Version: PHP Version 5.3.27
    • Database (MySQL, SQL Server, etc) Version: 5.1.61-log


    Thanks heaps!
    Sar

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

    [ed. note: insightdesign last edited this post 13 years, 1 month ago.]
    • discuss.answer
      • 3749
      • 24,544 Posts
      Do you mean getResources? I don't know of a GetResource snippet.

      What is your actual memory_limit?

      If the MODX install went OK, it's unlikely that getResources would eat too much memory unless you're getting a crapload of resources or the memory_limit has changed since you installed MODX.

      Are you sure the page with the getResources tag is not included in the resources the tag is getting? That would cause an infinite loop and suck up a lot of memory fast. The odds are good that you have a circular reference somewhere.

      You could also have a pair of corrupted resources where each is the other's parent.

        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
        • 37210
        • 131 Posts
        Quote from: BobRay at Aug 16, 2013, 02:28 AM
        You could also have a pair of corrupted resources where each is the other's parent.

        That is the most confusing thing I have read on this forum! But as usual, BobRay, you've made me come to the solution...although it doesn't make any sense to me but at least the error is gone and the website is back up and running.

        The Solution:
        I have a container that contains Static Resources which are being called by a GetResources call. Now, for some reason, one normal Resource threw a spanner in the works. So once I deleted the normal Resource, the error went away.

        (And yeah..I meant GetResources)

        :)
        SAR [ed. note: insightdesign last edited this post 13 years, 1 month ago.]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If the normal resource (say #42) has the getResources call in its content, and your getResources call is including content, then when getResources processes that resource #42 to add to its list, the getResources call in that content is again processed - repeat ad infinitum until the poor system runs out of memory.

            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 37210
            • 131 Posts
            Quote from: sottwell at Aug 16, 2013, 03:05 AM
            If the normal resource (say #42) has the getResources call in its content, and your getResources call is including content, then when getResources processes that resource #42 to add to its list, the getResources call in that content is again processed - repeat ad infinitum until the poor system runs out of memory.

            Yup. That is exactly what happened actually. Because that normal Resource (from my reply #3) had a GetResource call on it which was calling itself! Now I get it. It sounds super confusing in writing.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Computers, unlike teenagers, always do exactly what we tell them to do. The problem is figuring out what we've actually told them to do, not what we think we told them to do!
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 3749
                • 24,544 Posts
                Quote from: insightdesign at Aug 16, 2013, 02:48 AM
                Quote from: BobRay at Aug 16, 2013, 02:28 AM
                You could also have a pair of corrupted resources where each is the other's parent.

                That is the most confusing thing I have read on this forum!


                Thanks, that's my new claim to fame. I'm thinking of adding it to my sig. wink

                What I was describing can really happen, though luckily it's fairly rare.

                When you drag Resources around in the tree, MODX sometimes gets confused about the parents. Each Resource has an ID in its 'parent' field that tells MODX where it goes in the tree (i.e., under what parent). Imagine what happens if Resource 3's parent is 12 and Resource 12's parent is 3 and somebody calls UltimateParent, which walks up the tree from parent to parent. When it gets to one of those two Resources, it will just go back and forth between them until all available memory is gone, since each is the other's parent. To make things worse, they won't show up in the Resource tree any more.

                A similar problem (also possible) is when a Resource is its *own* parent. IOW, the same ID is stored in both the 'id' and the 'parent' fields of a single Resource.

                  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
                  • 37210
                  • 131 Posts
                  Quote from: sottwell at Aug 16, 2013, 04:14 AM
                  Computers, unlike teenagers, always do exactly what we tell them to do. The problem is figuring out what we've actually told them to do, not what we think we told them to do!

                  Too true. Either way, you find yourself yelling, "WHERE DID I GO WRONG!?"

                    • 37210
                    • 131 Posts
                    Quote from: BobRay at Aug 16, 2013, 06:49 PM
                    Thanks, that's my new claim to fame. I'm thinking of adding it to my sig. wink

                    That signature alone would scare people away from MODx! smiley