We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Hi, I have a site in production (Revo 2.2.13-pl) which my client is reporting is sometimes down both in the Manager and Front end - I went to check the error logo today and it's so big I have had to download it - 2.2mb! From looking at the log there are lots of errors being shown. None of which mean anything to me as I am not much into the server side of things... there seems to be a consistent sequence of bugs though which repeats many many times! I have added in below an example...

    `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties` FROM `modx_site_content` AS `modResource` WHERE  ( modResource.parent IN (49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107) AND `modResource`.`deleted` = ? AND `modResource`.`published` = ? )  ORDER BY RAND() DESC LIMIT 1  - 
    [2014-05-06 03:37:49] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:49] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:49] (ERROR @ /index.php) 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` = ?  - 
    [2014-05-06 03:37:49] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:49] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR @ /index.php) 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` = ?  - 
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    [2014-05-06 03:37:50] (ERROR in xPDOConnection::connect @ /srv/www.example.com/www/core/xpdo/xpdo.class.php : 3054) SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


    Does anyone have any ideas what the issue might be here? I can DM over the full bug list if that would help?

    Appreciate any insight here!

    Cheers,

    dubbs.
      • 3749
      • 24,544 Posts
      Almost all of those appear to be caused by the MySQL server being overtaxed and rejecting connections -- always a threat on shared hosting.

        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
        • 8168
        • 1,118 Posts
        Thanks Bob. Not sure what hosting the DB is on. I will check with the client. Any ideas on how to eradicate the errors?
          • 3749
          • 24,544 Posts
          If I'm right about the cause, the solution is probably for the host to shuffle some users around so the MySql server isn't overloaded.
            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
            • 8168
            • 1,118 Posts
            OK thanks Bob. I will pass this on to the server engineers and see what they can find. Will there be an error log in the DB / the DB server to inspect?
            • When MODX (or anybody) tries to connect to the database, a file is created to store the connection number so that the server knows who is asking for what, kind of like a temporary extension number for an office phone.

              There are several reasons why a database connection can fail. There isn't enough disk space to create these files, or the database is getting too many requests at one time, and it simply doesn't have time to write the files and run the database program are common issues. Database engines can be configured with "listeners", how many open connections can it handle at once, like how many phone lines to an office. It is possible to configure it to use more "listeners", but whether or not that will be a good idea depends on how much memory, disk space, and processor speed the server has.

              Another problem can be if the server is configured wrong, and the database engine is trying to write these files in a directory where it doesn't have permission to write.

              There should definitely be a database error log - that may be the problem, if the error logs are so big that they're eating up your allowed disk space.

              One solution to your problem may be to turn off the database storage for PHP sessions.

                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
                • 8168
                • 1,118 Posts
                Thanks Susan, I will pass all of this onto the server engineers and see if they can work out the issue and resolve it.
                  • 8168
                  • 1,118 Posts
                  Would upping the RAM on the server help?
                    • 11241
                    • 5 Posts
                    Quote from: sottwell at May 07, 2014, 05:49 AM


                    One solution to your problem may be to turn off the database storage for PHP sessions.


                    Hello @sottwell

                    How you could do this? Changing the value session_enabled?

                    I have the same problem, the RAM (VPS with 4 GB of RAM) is increasing until the service collapses every Saturday morning at 8 (CEST).

                    In most cases nothing happens, only I get an error in the logs (see below), but in other cases, it corrupts the database table modx_site_content.

                    The errors I receive are these:

                    [2018-08-25 08:00:09] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 236) PHP warning: PDOStatement::execute(): MySQL server has gone away
                    [2018-08-25 08:00:09] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 236) PHP warning: PDOStatement::execute(): Error reading result set's header
                    [2018-08-25 08:00:09] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 240) Error HY000 executing statement: 
                    Array
                    (
                        [0] => HY000
                        [1] => 2006
                        [2] => MySQL server has gone away
                    )

                    [2018-09-01 08:00:06] (ERROR in xPDOConnection::connect @ /home/myweb/public_html/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [2002] No such file or directory
                    [2018-09-01 08:00:06] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoquery.class.php : 652) 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 
                    [2018-09-01 08:00:06] (ERROR in xPDOConnection::connect @ /home/myweb/public_html/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [2002] No such file or directory
                    [2018-09-01 08:00:06] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoquery.class.php : 652) 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` = ? 
                    [2018-09-01 08:00:06] (ERROR in xPDOConnection::connect @ /home/myweb/public_html/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [2002] No such file or directory
                    [2018-09-01 08:00:06] (ERROR @ /home/myweb/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` = ?  - 
                    ....


                    and this errors when the table gets corrupted

                    [2018-08-18 08:00:09] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 1448) PHP warning: PDOStatement::execute(): MySQL server has gone away
                    [2018-08-18 08:00:09] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 1448) PHP warning: PDOStatement::execute(): Error reading result set's header
                    [2018-08-18 08:00:09] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 1452) Error HY000 executing statement:
                    UPDATE `modx_site_content` SET `properties` = '{\"hitspage\":{\"hitts\":780951}}' WHERE `id` = 1
                    Array
                    (
                        [0] => HY000
                        [1] => 2006
                        [2] => MySQL server has gone away
                    )
                    
                    [2018-08-18 08:00:15] (ERROR @ /home/myweb/public_html/core/xpdo/om/xpdoobject.class.php : 240) Error 42S02 executing statement: 
                    Array
                    (
                        [0] => 42S02
                        [1] => 1146
                        [2] => Table 'myweb_web3.modx_site_content' doesn't exist
                    )
                    
                    


                    Modx version: MODX Revolution 2.6.5-pl (advanced)
                    Database version: 5.6.39-log
                    PHP Version 5.6.37

                    Appreciate any insight here! Thanks
                    Gravino [ed. note: gravino last edited this post 5 years, 7 months ago.]