We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36467
    • 73 Posts
    Recently after the malware attack, we updated modx and moved to the new more secure server and then we noticed that our website takes ~1+ min to load and goes down many times a day, after investigating server support team is saying that below files are causing this issue

    lstat("/home/xxxxxx.com/core/cache/resource/modx_context1/resources/4.cache.php", 0x7ffe5ff9e4a0) = -1 ENOENT (No such file or directory)
    lstat("/home/xxxxxx.com/core/cache/resource/modx_context1/resources", 0x7ffe5ff9e2f0) = -1 ENOENT (No such file or directory)
    lstat("/home/xxxxxx.com/core/cache/resource/modx_context1", 0x7ffe5ff9e140) = -1 ENOENT (No such file or directory)
    lstat("/home/xxxxxx.com/core/cache/resource/modx_context1/resources/4.cache.php", 0x7ffe5ff9e4b0) = -1 ENOENT (No such file or directory)
    readlink("/home/xxxxxx.com/core/cache/resource/modx_context1/resources/4.cache.php", 0x7ffe5ffa3630, 4095) = -1 ENOENT (No such file or directory)
    lstat("/home/xxxxxx.com/core/cache/resource/modx_context1/resources", 0x7ffe5ff9e4b0) = -1 ENOENT (No such file or directory)
    lstat("/home/xxxxxx.com/core/cache/resource/modx_context1", 0x7ffe5ff9e4b0) = -1 ENOENT (No such file or directory)
    access("/home/xxxxxx.com/core/cache/resource/modx_context1/resources/4.cache.php", F_OK) = -1 ENOENT (No such file or directory)
    


    We have many contexts its throwing above errors for random contents like "context1" and then "context2",

    I tried disabling "cache_resource" from settings, now core/cache/resource is blank but still, it's checking for those cache files and httpd process hangs and slows down the website.

    Please note that the new server we are using is secure with many rules like only whitelisted IPs can use use modx manager, curl_exec is disabled.

    Can someone tell why is this happening, its been very frustrating.
      • 38783
      • 571 Posts
      Resource ID 4 is referenced a lot. What sort of content is on that resource? Is that a Gallery page? What happens is you 'un-publish that resource'?
        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com
        • 36467
        • 73 Posts
        Before this, it was throwing an error for some other context (we have like 8-10 contexts) like "modx_context2/resources/4.cache.php" .

        Strange thing is core/cache/folder is blank, i have disabled resource caching. But still its trying to access those files.
          • 3749
          • 24,544 Posts
          Do you have a resource with the ID 4?
          If so, what is it?

          If not, do you know what's trying to get it?

          It might be better to revert that setting and try setting the individual resources to not cacheable to see what effect that has.

            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
            • 36467
            • 73 Posts
            Ok i found that resource with id 4 is actually a 404 page, we have shared 404 page in all contexts. So i created a new resource (22785) and assigned it as error_pahe in settings, and now i am getting a similar error with changed id like below

            lstat("/home/example.com/core/cache/resource/video_context/resources/22785.cache.php", 0x7ffc3dea3ac0) = -1 ENOENT (No such file or directory)
            lstat("/home/example.com/core/cache/resource/video_context/resources", 0x7ffc3dea3900) = -1 ENOENT (No such file or directory)
            lstat("/home/example.com/core/cache/resource/video_context", 0x7ffc3dea3750) = -1 ENOENT (No such file or directory)
            lstat("/home/example.com/core/cache/resource", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
            lstat("/home/example.com/core/cache", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
            lstat("/home/example.com/core", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
            lstat("/home/example.com", {st_mode=S_IFDIR|0711, st_size=4096, ...}) = 0
            lstat("/home/banker/domains", {st_mode=S_IFDIR|0711, st_size=4096, ...}) = 0
            lstat("/home/banker", {st_mode=S_IFDIR|0710, st_size=4096, ...}) = 0
            lstat("/home", {st_mode=S_IFDIR|0711, st_size=4096, ...}) = 0
            lstat("/home/example.com/core/cache/resource/video_context/resources/22785.cache.php", 0x7ffc3dea3ad0) = -1 ENOENT (No such file or directory)
            readlink("/home/example.com/core/cache/resource/video_context/resources/22785.cache.php", 0x7ffc3dea8c50, 4095) = -1 ENOENT (No such file or directory)
            lstat("/home/example.com/core/cache/resource/video_context/resources", 0x7ffc3dea3ad0) = -1 ENOENT (No such file or directory)
            lstat("/home/example.com/core/cache/resource/video_context", 0x7ffc3dea3ad0) = -1 ENOENT (No such file or directory)
            lstat("/home/example.com/core/cache/resource", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
            lstat("/home/example.com/core/cache", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
            lstat("/home/example.com/core", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
            


            same list of errors for other contexts as well

            lstat("/home/example.com/core/cache/resource/image_context/resources/22785.cache.php", 0x7ffc3dea3ac0) = -1 ENOENT (No such file or directory)
            so on...
            


            When i go to cache, this url actually dont exits
            /home/example.com/core/cache/resource/video_context/resources/
            , cache folder only has this url
            /home/example.com/core/cache/resource/forums/
            but there is no folder like
            video_context
            or
            image_context
              • 38783
              • 571 Posts
              So your site is trying to redirect every page request to a 404, but it is unable to do so.

              When you rebuilt the site after the malware attack did you use a backup from before the 17th July?

              If not then I suspect you still have some malware present.

              I would check all .htaccess, php.ini and index.php files and .js files for unexpected content.

              Regarding your move to a new server this document contains all the things you need to check when moving to a new server, as paths to files change and .htaccess files need editing. I am sure you did all this but I would double check all the things discussed in this document.

              https://docs.modx.com/revolution/2.x/administering-your-site/moving-your-site-to-a-new-server

              Paths in these documents are important
              /config.core.php
              /connectors/config.core.php
              /manager/config.core.php

              define('MODX_CORE_PATH', '/path/to/modx_doc_root/core/');
              define('MODX_CONFIG_KEY', 'config');


              And check the paths in
              /core/config/config.inc.php

              /* PATHS */
              $modx_core_path= '/path/to/modx_doc_root/core/';
              $modx_processors_path= '/path/to/modx_doc_root/core/model/modx/processors/';
              $modx_connectors_path= '/path/to/modx_doc_root/connectors/';
              $modx_manager_path= '/path/to/modx_doc_root/manager/';
              $modx_base_path= '/path/to/modx_doc_root/';
              $modx_assets_path= '/path/to/modx_doc_root/assets/';
               
              /* HOST (used for command-line PHP stuff) */
              $http_host='yoursite.com';


              Could there be something in your .htaccess file that is relevant to the old server and needs adjusting in the new environment?

              Also double check that folder and file permissions are correct for the new environment. Probably 755 for folders and 644 or 664 for files. The exception being the /core/config/config.inc.php file which should be 400.

              After checking all the above I would try uploading a new 'setup' folder for MODX and run it again. (Make sure the setup folder is the same version as you are running - 2.6.5
                If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

                email: [email protected] | website: https://andytough.com