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

    I’ve had MODx 2.0.8 installed for several months as we built a site and are now allowing the client to login and populate around 135 resources. The site has performed normally until this weekend when the client reported the following issues:

    Frontend home page: Fatal error: Maximum execution time of 30 seconds exceeded in C:\inetpub\vhosts\actrained.com\httpdocs\core\model\modx\modcachemanager.class.php on line 137

    Manager: most elements load but Resources/Elements/Files document tree remains empty. Expanding root level will show animated ’loading icon’ but no content comes in and script times out after 30 sec trying to load:
    http://domain.draftwebsite.co.uk/connectors/browser/directory.php?action=getList&id=/

    phpMyAdmin reports no corrupted tables. I tried clearing the MODx cache but this makes no difference. Changing the server between PHP via ISAPI/CGI/FastCGI makes no difference. MODx Error Log has no entries since 13 July relating to ’skipping duplicate resource alias’ which I first presumed is irrelevent but see the code excerpt below. allow_duplicate_alias is set to No and friendly_urls is set to Yes.

    I considered upgrading to the latest version but as some of the packages are not on the latest versions I don’t want to risk this and am not keen to try to install the latest versions in case this timeout issue prevents this being done correctly.

    I tried disabling the cache via the Manager but this makes no difference.

    Can anyone suggest what to look at or if I could maybe import the database into a clean install of Revolution 2.0.8?

    Thanks,

    Chris

    Extract from modxcachemanager.class.php is:

    Looking at line 137 where the error occurs it appears to be looping through resource aliases.
                       if ((isset ($obj->config['friendly_urls']) && $obj->config['friendly_urls']) || $contextConfig['friendly_urls']) {
                            if ((isset ($obj->config['friendly_alias_urls']) && $obj->config['friendly_alias_urls']) || $contextConfig['friendly_alias_urls']) {
                                $resAlias= $r->alias;
                                if (empty ($resAlias)) $resAlias= $r->id;
                                $parentResource= '';
                                if ((isset ($obj->config['use_alias_path']) && $obj->config['use_alias_path'] == 1) || $contextConfig['use_alias_path']) {
                                    $pathParentId= $parentId;
                                    $parentResources= array ();
                                    $currResource= $r;
                                    $parentSql= "SELECT {$resourceCols} FROM {$tblResource} `r` WHERE `r`.`id` = :parent AND `r`.`id` != `r`.`parent` LIMIT 1";
                                    $hasParent= (boolean) $pathParentId;
                                    if ($hasParent) {
                                        if ($parentStmt= $this->modx->prepare($parentSql)) {
                                            $parentStmt->bindParam(':parent', $pathParentId);
                                            if ($parentStmt->execute()) {
                                                while ($hasParent && $currResource= $parentStmt->fetch(PDO::FETCH_OBJ)) {
                                                    $parentAlias= $currResource->alias;
                                                    if (empty ($parentAlias))
                                                        $parentAlias= "{$pathParentId}";
                                                    $parentResources[]= "{$parentAlias}";
                                                    $pathParentId= $currResource->parent;
                                                    [b]$hasParent= ($pathParentId > 0 && $parentStmt->execute());  <<<<<<<<< line 137[/b]
                                                }
                                            }
                                        }
                                    }
                                    $resPath= !empty ($parentResources) ? implode('/', array_reverse($parentResources)) : '';
                                }
                            } else {
                                $resAlias= $r->id;
                            }
                            if (!empty($containerSuffix) && $r->isfolder) {
                                $resourceExt= $containerSuffix;
                            } else {
                                $resourceExt= $contentType->getExtension();
                            }
                            if (!empty($resourceExt)) {
                                $resAlias .= $resourceExt;
                            }
                        } else {
                            $resAlias= $r->id;
                        }
    



    Environment details are below.

    Web Server:

    * PHP version and how it’s running (suexec, mod_php, CGI, etc.) - PHP Version 5.2.13, FastCGI
    * Apache or IIS version - IIS v7.5
    * Operating System and version - Windows Server 2008 R2 Standard

    Database:

    * MySQL version - 5.1.51 Community
    * List of any tables over 1MB in size - none

    MODx:

    * Version - MODx Revolution 2.0.8-pl (traditional)
    * Any changes you’ve made - none other than installing some packages
    * Any snippets you’re running on the page that is not working properly
    * Any plugins you’re running - archivist 1.1.0, batcher 1.1.0, breadcrumbs 1.1, codemirror 2.0.0,

    getpage 1.0.0, getresources 1.3.0, googlesitemap 1.2.1, if 1.1, quickcrumbs 1.0.0, simplesearch

    1.4.0, taglister 1.1.3, tinymce 4.2.3, wayfinder 2.3.1

    Browser/Client:

    * Browser name and version - Firefox 3.6.18
    * Operating System and version - Windows 7 64bit

      • 5160
      • 118 Posts
      It looks like it’s something to do with the Friendly URLs config.


                         if ((isset ($obj->config['friendly_urls']) && $obj->config['friendly_urls']) || $contextConfig['friendly_urls']) {


      If I set friendly_urls to No and use_alias_path to No the frontend of the site responds somewhat. A number of the supporting pages of the site are visible and working - sitemap (wayfinder snippet), testimonials etc. basically all the resources in the root of the Web Context.

      In the manager, under Resources the document tree for the Web context is not displaying all that it should be. There are a number of resources in the database with children making up the main sections of the website. These appear to be in the database as they should but they are not showing in the Resource Tree.

      Does this suggest what I should be looking for next?

      Chris
        • 5160
        • 118 Posts
        Performed a reinstall of the same version 2.0.8 using the same files as this was installed from by following the Upgrade process but this has made no difference so I guess no files had become corrupted.
          • 5160
          • 118 Posts
          Panic over. Turns out the Client had somehow managed to change the parent ID of a top level category for an ID relating to a sub category. This must have thrown one of the modules into an infinite loop causing the timeout. I did note that the wayfinder module was writing out the same category name many times.