• Resolved alriknijdam

    (@alriknijdam)


    Hi there,

    Really hope you guys can help me! My debug.log is showing a lot of notices/warnings and after a while my server shuts down. The server can run well for days, or just seconds before it crashes and needs to be reset (there is no patern). It looks like it has something to do with the WP database and querys but I can’t figure out what to do.

    These 3 lines just keep on repeating themself

    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3736
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3738
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3740

    And every so often this line pops up
    PHP Notice: get_wp_title_rss was called with an argument that is <strong>outdated</strong> since version 4.4.0. Use <code>document_title_separator</code>-filter instead . in /wp-includes/functions.php on line 4045

    This goes on for awhile and eventually my server decides to shut down

    PHP Warning:  mysqli_real_connect(): MySQL server has gone away in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531
    PHP Warning:  mysqli_real_connect(): Error while reading greeting packet. PID=5183 in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531
    PHP Warning:  mysqli_real_connect(): (HY000/2006): MySQL server has gone away in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531
    
    PHP Warning:  mysqli_query(): MySQL server has gone away in /home/vespacia/public_html/wp-includes/wp-db.php on line 1924
    PHP Warning:  mysqli_query(): Error reading result set's header in /home/vespacia/public_html/wp-includes/wp-db.php on line 1924
    
    PHP Warning:  mysqli_real_connect(): (HY000/2002): Connection refused in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531
    PHP Warning:  Error while sending QUERY packet. PID=5139 in /home/vespacia/public_html/wp-includes/wp-db.php on line 1924
    PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531
    
    WordPress databasefout MySQL server has gone away bij query 
    			SELECT l.ID, post_title, post_content, post_name, post_parent, post_author, post_modified_gmt, post_date, post_date_gmt
    			FROM (
    				SELECT wp_posts.ID
    				FROM wp_posts
    				
    				
    		
    		WHERE wp_posts.post_status = 'publish'
    			AND wp_posts.post_type = 'reply'
    			AND wp_posts.post_password = ''
    			AND wp_posts.post_date != '0000-00-00 00:00:00'
    		
    					
    				ORDER BY wp_posts.post_modified ASC LIMIT 100 OFFSET 12200
    			)
    			o JOIN wp_posts l ON l.ID = o.ID
    		 gemaakt door require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Sitemaps->redirect, WPSEO_Sitemaps->build_sitemap, WPSEO_Post_Type_Sitemap_Provider->get_sitemap_links, WPSEO_Post_Type_Sitemap_Provider->get_posts
    
    PHP Warning:  mysqli_real_connect(): (HY000/2002): Connection refused in /wp-includes/wp-db.php on line 1531
    PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /wp-includes/wp-db.php on line 1531
    PHP Warning:  Error while sending QUERY packet. PID=5167 in /wp-includes/wp-db.php on line 1924		 
    PHP Notice:  wpdb was called <strong>incorrectly</strong>. wpdb must set up a database connection for the use of 'escaping'. Read <a href="https://codex.www.ads-software.com/Debugging_in_WordPress"> WordPress troubleshooting </a> for more information. (This message has been added in version 3.6.0.) in /home/vespacia/public_html/wp-includes/functions.php on line 4161
    PHP Warning:  mysqli_real_connect(): (08004/1040): Too many connections in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531
    PHP Warning:  mysqli_real_connect(): (HY000/1040): Too many connections in /home/vespacia/public_html/wp-includes/wp-db.php on line 1531

    I also came across a couple of these lines but there are only a few of them

    WordPress database error Table 'wp_options' is marked as crashed and should be repaired bij query SELECT option_value FROM wp_options WHERE option_name = '_transient_external_ip_address_77.170.21.115' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, WC_Customer->__construct, WC_Data_Store->read, WC_Customer_Data_Store_Session->read, WC_Customer_Data_Store_Session->set_defaults, wc_get_customer_default_location, WC_Geolocation::geolocate_ip, WC_Geolocation::get_external_ip_address, get_transient, get_option
    WordPress database error Duplicate entry '_transient_external_ip_address_77.170.21.115' for key 'option_name' bij query INSERT INTO <code>wp_options</code> (<code>option_name</code>, <code>option_value</code>, <code>autoload</code>) VALUES ('_transient_external_ip_address_77.170.21.115', '2a01:7c8:aab6:b:5054:xxxx:xxxx:xxxx', 'no') ON DUPLICATE KEY UPDATE <code>option_name</code> = VALUES(<code>option_name</code>), <code>option_value</code> = VALUES(<code>option_value</code>), <code>autoload</code> = VALUES(<code>autoload</code>) gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, WC_Customer->__construct, WC_Data_Store->read, WC_Customer_Data_Store_Session->read, WC_Customer_Data_Store_Session->set_defaults, wc_get_customer_default_location, WC_Geolocation::geolocate_ip, WC_Geolocation::get_external_ip_address, set_transient, add_option
    
    WordPress database error Table 'wp_options' is marked as crashed and should be repaired bij query SELECT option_value FROM wp_options WHERE option_name = '_transient_external_ip_address_77.170.xxx.xxx' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, WC_Customer->__construct, WC_Data_Store->read, WC_Customer_Data_Store_Session->read, WC_Customer_Data_Store_Session->set_defaults, wc_get_customer_default_location, WC_Geolocation::geolocate_ip, WC_Geolocation::get_external_ip_address, get_transient, get_option
    WordPress database error Duplicate entry '_transient_external_ip_address_77.170.xxx.xxx' for key 'option_name' bij query INSERT INTO <code>wp_options</code> (<code>option_name</code>, <code>option_value</code>, <code>autoload</code>) VALUES ('_transient_external_ip_address_77.170.xxx.xxx', '149.210.xxx.xxx', 'no') ON DUPLICATE KEY UPDATE <code>option_name</code> = VALUES(<code>option_name</code>), <code>option_value</code> = VALUES(<code>option_value</code>), <code>autoload</code> = VALUES(<code>autoload</code>) gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce->init, WC_Customer->__construct, WC_Data_Store->read, WC_Customer_Data_Store_Session->read, WC_Customer_Data_Store_Session->set_defaults, wc_get_customer_default_location, WC_Geolocation::geolocate_ip, WC_Geolocation::get_external_ip_address, set_transient, add_option

    Edit, and these:

    PHP Notice:  Undefined index: host in /wp-includes/canonical.php on line 461
    PHP Notice:  Undefined index: host in /wp-includes/canonical.php on line 462
    PHP Notice:  Undefined index: host in /wp-includes/canonical.php on line 463
    PHP Notice:  Undefined index: host in /wp-includes/canonical.php on line 465
    PHP Notice:  Undefined index: scheme in /wp-includes/canonical.php on line 482

    WordPress 4.9.8, theme and all plugins are up to date.
    Apache version: Apache/2.2.27
    PHP version: 7.1.0
    MySQL version: 5.1.73
    (If needed I have acces to everything)

    Best regards,
    Alrik

    • This topic was modified 6 years ago by alriknijdam. Reason: more notices

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • RoseHosting

    (@rosehosting)

    It seems like the ‘wp_options’ table is crashed. If you have access to the command line you can easily repair it using the following command;

    mysqlcheck --repair db_name

    where ‘db_name’ is the actual name of the database.

    You can do this through phpMyAdmin too. Access phpMyadmin, select the WordPress database and table, click the ‘With selected’ drop-down menu and select ‘Repair table’.

    Thread Starter alriknijdam

    (@alriknijdam)

    Thanks for the quick reply! I just executed the repair query successfully. Now we’ll have to wait for a little while to see if it worked.

    I’ll definitely get back to you with the results.

    Best regards,
    Alrik

    Thread Starter alriknijdam

    (@alriknijdam)

    Alright, it has almost been 2 days now so time for an update.
    First of all, the advice of @rosehosting had a huge impact on the cpu load of the server, decreasing it more than 50%. Needless to say I’m happy with that!

    After repairing ‘wp_options’ the server was stable for a little over 24 hours. During which it kept producing the same PHP Notices as before.

    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3736
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3738
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3740
    
    PHP Notice: get_wp_title_rss was called with an argument that is <strong>outdated</strong> since version 4.4.0. Use <code>document_title_separator</code>-filter instead. in /wp-includes/functions.php on line 4045

    The query also being the same.

    WordPress database error MySQL server has gone away bij query
    SELECT l.ID, post_title, post_content, post_name, post_parent, post_author, post_modified_gmt, post_date, post_date_gmt
    FROM (
    	SELECT wp_posts.ID
    	FROM wp_posts
    	
    	WHERE wp_posts.post_status = 'publish'
    		AND wp_posts.post_type = 'reply'
    		AND wp_posts.post_password = ''
    		AND wp_posts.post_date != '0000-00-00 00:00:00'
    
    	ORDER BY wp_posts.post_modified ASC LIMIT 100 OFFSET 30200
    )
    o JOIN wp_posts l ON l.ID = o.ID
    made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Sitemaps->redirect, WPSEO_Sitemaps->build_sitemap, WPSEO_Post_Type_Sitemap_Provider->get_sitemap_links, WPSEO_Post_Type_Sitemap_Provider->get_posts

    Since I’m completely in the dark here and got curious I decided to run the query in phpMyAdmin. Leaving the JOIN part out because I didn’t know if it would make any changes. This gave the following error.
    #1248 - Message: Every derived table must have its own alias

    After the last server crash the cpu load again saw a huge drop. Earlier the load could easily exceed 200%, at this point it has been rather stable around 30% over 12 hours. Besides from repairing ‘wp_options’ I can’t think of anything that caused the second drop (no changes made).

    Is it possible that somehow a bad query is injected. Either by accident or with malicious intend? Looking at the ‘mady by’ part of the query I see a lot of WPSEO Sitemap stuff, might a crawler be the cause?

    As this exceeds my knowledge by a mile I might sound a bit stupid, but I’m just trying to understand it ??

    Thread Starter alriknijdam

    (@alriknijdam)

    So here I am again, still trying to get this fixed. I know it’s only a php notice, but after 24 hours I can find these 4 lines over 10.000 times in my debug.log.

    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3736
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3738
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3740
    
    PHP Notice: get_wp_title_rss was called with an argument that is <strong>outdated</strong> since version 4.4.0. Use <code>document_title_separator</code>-filter instead. in /wp-includes/functions.php on line 4045

    If I saw this notice just a couple of times I would have patiently waited for an update to fix it. But seeing it thousands of times is a bit much don’t you think.

    Thread Starter alriknijdam

    (@alriknijdam)

    Is there anything I can do myself to get these notices figured out?
    Or do I need to adress them somewhere else?

    Best regards,
    Alrik

    Thread Starter alriknijdam

    (@alriknijdam)

    Alright I finally might be onto something here, I now know what triggers it!!

    It’s got something to do with RSS/XSS. As soon as someone visits a page such as https://example.com/leden/user/activity/favorites/feed/ the PHP notices pop up, and my server recources are completely drained.
    It can take up to 3 hours before the server finally settles down and everything is fine again.

    I really really hope someone can help me out now we know what causes it.

    Thread Starter alriknijdam

    (@alriknijdam)

    Placed the code at the bottom of this post inside my functions.php
    That settles everything down.. So far…… Hoping it will stay this way..
    Strange enough https://example.com/leden/user/activity/favorites/feed/ still shows a RSS feed though, but no longer produces server issues. It also still produces the same 3 php notices

    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3736
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3738
    PHP Notice:  Trying to get property of non-object in /wp-includes/class-wp-query.php on line 3740

    Needless to say I’m still looking for a solution

    function wpb_disable_feed() {
    wp_die( __('No feed available,please visit our <a href="https://vespa-ciao.nl/">homepage</a>!') );
    }
     
    add_action('do_feed', 'wpb_disable_feed', 1);
    add_action('do_feed_rdf', 'wpb_disable_feed', 1);
    add_action('do_feed_rss', 'wpb_disable_feed', 1);
    add_action('do_feed_rss2', 'wpb_disable_feed', 1);
    add_action('do_feed_atom', 'wpb_disable_feed', 1);
    add_action('do_feed_rss2_comments', 'wpb_disable_feed', 1);
    add_action('do_feed_atom_comments', 'wpb_disable_feed', 1);
    // onderstaande schakelt ook de RSS in de header links uit
    remove_action( 'wp_head', 'feed_links_extra', 3 );
    remove_action( 'wp_head', 'feed_links', 2 );
    Thread Starter alriknijdam

    (@alriknijdam)

    Found it, Woocommerce is the problem!!
    I opened a support ticket with them:
    https://www.ads-software.com/support/topic/major-database-issues-server-chrash/

    First of all, you’re running a very old (2013) version of MySQL. Also your version of Apache is end of life. It might be worth updating it.

    Second, the /feed/ issue is a known issue ( https://github.com/woocommerce/woocommerce/issues/21756 ), which unfortunately hasn’t been fixed yet. But it’s not related to your database issue.

    Your main concern seems to be your server setup. Is it managed by your host, or do you manage it yourself? Take a look at the log files of mysql to see if there’s something of interest there.

    Also, I’m not an expert about Database Administration, this comes to mind: Do you know whether you’re running MyISAM or InnoDB? InnoDB supports row-level locking, which might make a huge difference if your site gets a lot of traffic and transients are written to wp_options. InnoDB also has safer recovery options. See https://kinsta.com/knowledgebase/convert-myisam-to-innodb/

    Good luck!

    Also, can you see which processes consume a lot of CPU load? By using top or ps or whatever tool?

    Thread Starter alriknijdam

    (@alriknijdam)

    Thanks for responding and clarifying the issue is with the server setup. It is self managed and I’ve been trying to get the owner to either re-install the server or switch to managed hosting for a while now.
    I’ve passed your answer along and by the looks of it he’s finally convinced this is a good idea (to switch to managed hosting).

    Using the top command it’s always mysql that consumes all cpu and memory when the problem arises. The only thing that calms it dowm is disabling woocommerce. However, given your answer I expect this issue will be resolved as soon he switches to managed hosting.

    Again, thanks for answering, it’s been quit a struggle ??

    Using the top command it’s always mysql that consumes all cpu and memory when the problem arises. The only thing that calms it dowm is disabling woocommerce.

    Hmm… this is very suspicious. Do you get many concurrent requests?

    You can use the plugin https://nl.www.ads-software.com/plugins/query-monitor/ to debug database related issues. It displays the amount of queries executed per request and the time it takes. If I recall correctly you need to define( 'SAVEQUERIES', true ); in wp-config.php for more detail.

    Succes met de zoektocht.

    Thread Starter alriknijdam

    (@alriknijdam)

    I will do this somewhere in the middle of the night when most users are asleep since we’ve already experienced quite some downtime.

    I will get back with the results as soon as I’ve done this!

    Pro tip: Get a staging/testing environment.

    Thread Starter alriknijdam

    (@alriknijdam)

    Well I tried overloading my server again, but I’m no longer able to do so (at least not to the point of it chrashing). There has only been one change, I’ve updated the theme…

    I’m kinda sorry I can’t supply you with more information since I’m now unable to overload the server. On the other hand I’m very glad I can’t ??

    Nonetheless I want to thank you for the time you’ve invested in helping me!

    Best regards,
    Alrik

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘debug.log notices and server crash’ is closed to new replies.