10-23-2010, 08:55 AM #1Junior Guru Wannabe
- Join Date
- Jan 2008
Wordpress SQL Query Crashes Server .. Logged everything!
Hi,I've got a problem and need some help. If you are familiar with administrating a server with wordpress+supercache you might know the problem.
Problem: Some SQL queries crash my server on specific times. Starting at 8AM and then couple of times during the day.
CENTOS 5.5 i686
Plugin: Wp-Supercache (Important)
Since this problem occurred I've been logging everything.
Time of occurrence: Starting at 8AM!!
During night no problems. Then at 8AM EST mysql.slow.log is starting to log slow queries. This happened on two days in a row now starting at 8:02.04 and 8:04:36.
I find a lot of the long queries in my database: SELECT SELECTCode:
SQL_CALC_FOUND_ROWS distinct wordpress_posts.* FROM wordpress_posts LEFT JOIN wordpress_term_relationships ON (wordpress_posts.ID = wordpress_term_relationships.object_id) LEFT JOIN wordpress_term_taxonomy ON wordpress_term_taxonomy.term_taxonomy_id = wordpress_term_relationships.term_taxonomy_id WHERE 1=1 AND wordpress_posts.post_type = 'post' AND (wordpress_posts.post_status = 'publish') AND NOT EXISTS (SELECT * FROM wordpress_term_relationships JOIN wordpress_term_taxonomy ON wordpress_term_taxonomy.term_taxonomy_id = wordpress_term_relationships.term_taxonomy_id WHERE wordpress_term_relationships.object_id = wordpress_posts.ID AND wordpress_term_taxonomy.term_id IN (8) ) AND TIMESTAMPDIFF(MINUTE, wordpress_posts.post_date_gmt, '2010-10-23 12:02:01') > 600 ORDER BY wordpress_posts.post_date DESC LIMIT 0, 10;
Is there a trigger for the problem?
Yes, I might be able to trigger it. This could be a coincidence, but a couple times now the SQL server crashed when I saved a Wordpress Draft.
Apache Error Log at same time: Keep in mind I did not request that graceful restart.
[Sat Oct 23 08:00:13 2010] [error] [client 22.214.171.124] (36)File name too long: access to /wp-includes/js/thickbox/thickboxion:"yes",encode:"yes"................. [Sat Oct 23 08:01:19 2010] [notice] Graceful restart requested, doing restart [Sat Oct 23 08:01:26 2010] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) [Sat Oct 23 08:01:26 2010] [notice] Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 PHP/5.2.9 configured -- resuming normal operations [Sat Oct 23 08:01:38 2010] [error] [client 126.96.36.199] PHP Fatal error: Call to a member function get() on a non-object in /public_html/wp-includes/cache.php on line 93 [Sat Oct 23 08:03:15 2010] [error] [client 188.8.131.52] PHP Fatal error: Call to a member function get() on a non-object in /wp-includes/cache.php on line 93 [Sat Oct 23 08:08:07 2010] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) [Sat Oct 23 08:08:07 2010] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec) [Sat Oct 23 08:08:07 2010] [notice] ModSecurity for Apache/2.5.12 (http://www.modsecurity.org/) configured. [Sat Oct 23 08:08:08 2010] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) [Sat Oct 23 08:08:08 2010] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
I disabled a lot of plugins and cleaned the wordpress_options table. However, I did not update ANY plugins and this worked for months, so why should it start making problems now?
What troubles me is the fact that mysql.slow.log started to log slow queries over 1s at almost the same time for two days in a row? Coincidence? Someone exploiting a vulnerability?
I am very grateful for any help or ideas how to solve this.RLTT.com is for SALE Realtime Technologies is the way to go !
10-23-2010, 09:22 AM #2Junior Guru Wannabe
- Join Date
- Jan 2008
I might have the solution, I am pretty sure. As discussed here the plugin Advanced Category Exclude is causing a lot of problems:
Although I haven't changed anything in months, I did post something and used the Advanced Category Excluder to exclude a post...
This plugin might be causing all the problems. Looks like plugins can really cause a lot of trouble. At least my site is now blazing fast again.
My tip: Clean out wordpress-options and disable ALL plugins that are not 100% required. Seriously, I will think twice about activating any plugin now.RLTT.com is for SALE Realtime Technologies is the way to go !
10-23-2010, 05:02 PM #3******* Unleaded
- Join Date
- Feb 2004
The query itself is a monster. It *might* be accepted into production by a dba, but only under the most pressing circumstances and only after every avenue to avoid it had been exhausted.
The problem with wordpress plugins is that not all of them are well written. Some enthusiast throws something together to achieve a particular personal requirement, and then publishes it. Others come along and grab it without any thought as to whether it might be good code.
By wandana in forum Web HostingReplies: 2Last Post: 05-16-2008, 02:13 PM
By Amish_Geek in forum Programming DiscussionReplies: 10Last Post: 06-28-2006, 01:26 PM
By crEA-tEch in forum Programming DiscussionReplies: 2Last Post: 04-28-2004, 05:30 PM
By zoid in forum Programming DiscussionReplies: 2Last Post: 09-20-2003, 08:56 PM
By RunOfTheMill in forum Web HostingReplies: 7Last Post: 08-06-2001, 02:19 PM