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

    I have a very very strange issue with one Revo website.

    So... since few days, ONE website has is frontend stop working when your are not logged to the manager.
    The browser is looking, looking and finally, avec 3 real minutes, I have an Error 500

    Worse : when the browser is attempting to load the website, my server is going wrong : the apache2 process is "burning" and I have to restart the service.
    Only for ONE visitor. Imagine...
    Hopefully it is not a very visited website....

    Few days ago, I had change user access with ACL policy. But in case I did something wrong, I get down a 3 weeks ago database backup : same problem !


    When I want to go to the front end of my website when I'm not logged, on my modx log, I have this when the error 500 occurs :

    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `modExtensionPackage`.`id`, `modExtensionPackage`.`namespace`, `modExtensionPackage`.`name`, `modExtensionPackage`.`path`, `modExtensionPackage`.`table_prefix`, `modExtensionPackage`.`service_class`, `modExtensionPackage`.`service_name`, `modExtensionPackage`.`created_at`, `modExtensionPackage`.`updated_at`, Namespace.path AS namespace_path FROM `modx_extension_packages` AS `modExtensionPackage` JOIN `modx_namespaces` `Namespace` ON `modExtensionPackage`.`namespace` =  `Namespace`.`name` ORDER BY namespace ASC 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `modSession`.`id` AS `modSession_id`, `modSession`.`access` AS `modSession_access`, `modSession`.`data` AS `modSession_data` FROM `modx_session` AS `modSession` WHERE `modSession`.`id` = ? 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modSession`.`id` AS `modSession_id`, `modSession`.`access` AS `modSession_access`, `modSession`.`data` AS `modSession_data` FROM `modx_session` AS `modSession` WHERE `modSession`.`id` = ?  - 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `modNamespace`.`name` AS `modNamespace_name`, `modNamespace`.`path` AS `modNamespace_path`, `modNamespace`.`assets_path` AS `modNamespace_assets_path` FROM `modx_namespaces` AS `modNamespace` WHERE `modNamespace`.`name` = ? 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modNamespace`.`name` AS `modNamespace_name`, `modNamespace`.`path` AS `modNamespace_path`, `modNamespace`.`assets_path` AS `modNamespace_assets_path` FROM `modx_namespaces` AS `modNamespace` WHERE `modNamespace`.`name` = ?  - 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `modNamespace`.`name` AS `modNamespace_name`, `modNamespace`.`path` AS `modNamespace_path`, `modNamespace`.`assets_path` AS `modNamespace_assets_path` FROM `modx_namespaces` AS `modNamespace` WHERE `modNamespace`.`name` = ? 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modNamespace`.`name` AS `modNamespace_name`, `modNamespace`.`path` AS `modNamespace_path`, `modNamespace`.`assets_path` AS `modNamespace_assets_path` FROM `modx_namespaces` AS `modNamespace` WHERE `modNamespace`.`name` = ?  - 
    [2017-10-19 22:53:34] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:34] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `modLexiconEntry`.`id` AS `modLexiconEntry_id`, `modLexiconEntry`.`name` AS `modLexiconEntry_name`, `modLexiconEntry`.`value` AS `modLexiconEntry_value`, `modLexiconEntry`.`topic` AS `modLexiconEntry_topic`, `modLexiconEntry`.`namespace` AS `modLexiconEntry_namespace`, `modLexiconEntry`.`language` AS `modLexiconEntry_language`, `modLexiconEntry`.`createdon` AS `modLexiconEntry_createdon`, `modLexiconEntry`.`editedon` AS `modLexiconEntry_editedon` FROM `modx_lexicon_entries` AS `modLexiconEntry` JOIN `modx_namespaces` `Namespace` ON `modLexiconEntry`.`namespace` =  `Namespace`.`name` WHERE  ( `modLexiconEntry`.`topic` = ? AND `modLexiconEntry`.`language` = ? AND `Namespace`.`name` = ? )  ORDER BY `modLexiconEntry`.`name` ASC 
    ......
    [2017-10-19 22:53:43] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:43] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modLexiconEntry`.`id` AS `modLexiconEntry_id`, `modLexiconEntry`.`name` AS `modLexiconEntry_name`, `modLexiconEntry`.`value` AS `modLexiconEntry_value`, `modLexiconEntry`.`topic` AS `modLexiconEntry_topic`, `modLexiconEntry`.`namespace` AS `modLexiconEntry_namespace`, `modLexiconEntry`.`language` AS `modLexiconEntry_language`, `modLexiconEntry`.`createdon` AS `modLexiconEntry_createdon`, `modLexiconEntry`.`editedon` AS `modLexiconEntry_editedon` FROM `modx_lexicon_entries` AS `modLexiconEntry` JOIN `modx_namespaces` `Namespace` ON `modLexiconEntry`.`namespace` =  `Namespace`.`name` WHERE  ( `modLexiconEntry`.`topic` = ? AND `modLexiconEntry`.`language` = ? AND `Namespace`.`name` = ? )  ORDER BY `modLexiconEntry`.`name` ASC  - 
    [2017-10-19 22:53:43] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:43] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `alias` FROM `modx_tagger_groups` AS `TaggerGroup` 
    [2017-10-19 22:53:43] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:43] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoquery.class.php : 653) Could not construct or prepare query because it is invalid or could not connect: SELECT `modSession`.`id` AS `modSession_id`, `modSession`.`access` AS `modSession_access`, `modSession`.`data` AS `modSession_data` FROM `modx_session` AS `modSession` WHERE `modSession`.`id` = ? 
    [2017-10-19 22:53:43] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:43] (ERROR @ /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoobject.class.php : 263) Error preparing statement for query: SELECT `modSession`.`id` AS `modSession_id`, `modSession`.`access` AS `modSession_access`, `modSession`.`data` AS `modSession_data` FROM `modx_session` AS `modSession` WHERE `modSession`.`id` = ?  - 
    [2017-10-19 22:53:43] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    [2017-10-19 22:53:43] (ERROR in xPDOConnection::connect @ /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php : 3116) SQLSTATE[42000] [1203] User User_mydbname already has more than 'max_user_connections' active connections
    
    
    
    



    And on my apache2 server log :
    
    
    2017/10/20 00:58:29 [error] 1817#1817: *13137 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 158.13.18.19, server: mydomain.fr, request: "GET / HTTP/1.1", upstream: "https://32.233.12.140:8443/", host: "www.mydomain.fr"
    2017/10/20 00:59:59 [error] 1817#1817: *13137 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 158.13.18.19, server: mydomain.fr, request: "GET /favicon.ico HTTP/1.1", upstream: "https://32.233.12.140:8443/favicon.ico", host: "www.mydomain.fr", referrer: "https://www.mydomain.fr/"
    [Fri Oct 20 01:00:19.106571 2017] [:error] [pid 14175] [client 32.233.12.140:37462] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php on line 596, referer: https://www.mydomain.fr/manager/?a=workspaces
    [Fri Oct 20 01:00:53.579718 2017] [:error] [pid 13706] [client 32.233.12.140:37500] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in /home/User/web/mydomain.fr/public_html/core/model/modx/modresource.class.php on line 759, referer: https://www.mydomain.fr/manager/?a=workspaces
    [Fri Oct 20 01:01:09.817854 2017] [:error] [pid 14174] [client 32.233.12.140:37532] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php on line 2809, referer: https://www.mydomain.fr/manager/?a=workspaces
    [Fri Oct 20 01:01:17.814552 2017] [:error] [pid 13703] [client 32.233.12.140:37654] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in /home/User/web/mydomain.fr/public_html/core/xpdo/xpdo.class.php on line 1594, referer: https://www.mydomain.fr/manager/?a=workspaces
    [Fri Oct 20 01:01:21.490556 2017] [:error] [pid 14172] [client 32.233.12.140:37678] PHP Fatal error:  Maximum execution time of 60 seconds exceeded in /home/User/web/mydomain.fr/public_html/core/xpdo/om/xpdoobject.class.php on line 2417, referer: https://www.mydomain.fr/manager/?a=workspaces
    
    


    But if I'm connected as admin on the manager, I can go on the frontend without problem.


    What I did :
    - I get back a database backup from 2 weeks (when the website worked well, before the ACL changes)...
    - I have deleted the /core/cache content, and purge permissions
    - reupdate MODX to last version (2.5.8-pl) without problem
    - reinstall new instance modx from sources, change config.inc.php credential and load /assets/
    - repair mysql database

    ... and on all these cases, the problem was still there


    I precise I'm hosting on this server around 60 other Revo websites build by myself, and all are working well.

    I don't know what to do more...

      • 3749
      • 24,544 Posts
      My best guess is that your database is overloaded, although the fact that it affects just this one site suggest a problem with either .htaccess or a snippet or plugin on the site.

      One possibility is your context routing system sending users back and forth endlessly between contexts under some circumstances.

      If your error_page is not published, or is hidden by a permission rule, that will rout the user back to it endlessly.

      Another possibility is a circular reference in a template, though that's less likely since it doesn't happen when you view from the Manager.

        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
        • 36818
        • 119 Posts
        I had a similar issue a week ago (at least the max_user_connections error) . Just guessing: is it a multilingual site? If so, in my case it was the system setting
        error_page
        . I had one error site from one context entered there.
        The solution was to define a error site per context. That resolved the problem.

        I found the solution by accessing the server by ssh, watched the processes list with
        top
        and
        ps -ax
        then traced the problematic looking ones with
        strace -p"process number" -o /www/strace.log
        .
          • 28173
          • 409 Posts
          Thanks for your two answers !

          I'm digging on this way :
          If your error_page is not published, or is hidden by a permission rule, that will rout the user back to it endlessly.

          And obviously, after adding a new error page linked by the error_page key setting, my front end page is now loading the new error page !
          And I have only few resources loaded with Wayfinder.
          It's look like an ACL problem...
            • 3749
            • 24,544 Posts
            If you make yourself a sudo user, all ACL issues go away since a sudo user bypasses all permission tests. If that makes the problem go away (and you're logged in as that sudo user in the front end), it's definitely an ACL issue. Note that you have to explicitly log in to the front end.

            Your error_page should never belong to any Resource Groups. If it does, start by removing it, flushing permissions and settings, and deleting all files in the core/cache directory.
              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
              • 28173
              • 409 Posts
              Thanks your your very interesting answers Bob smiley