Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Posts
    77

    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
    WHM 11.26.20
    Wordpress 3.01
    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.

    SQL Queries
    I find a lot of the long queries in my database: SELECT SELECT
    Code:
    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.

    Code:
    [Sat Oct 23 08:00:13 2010] [error] [client 112.206.31.187] (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 72.135.102.154] 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.214.4.38] 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 !

  2. #2
    Join Date
    Jan 2008
    Posts
    77
    I might have the solution, I am pretty sure. As discussed here the plugin Advanced Category Exclude is causing a lot of problems:
    http://osdir.com/ml/wordpress-hacker.../msg00237.html

    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 !

  3. #3
    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.
    edgedirector.com
    managed dns global failover and load balance (gslb)
    exactstate.com
    uptime report for webhostingtalk.com

  4. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2008, 02:13 PM
  2. SQL query help?
    By Amish_Geek in forum Programming Discussion
    Replies: 10
    Last Post: 06-28-2006, 01:26 PM
  3. Server eventually crashes when I'm performing lots of sql queries?
    By crEA-tEch in forum Programming Discussion
    Replies: 2
    Last Post: 04-28-2004, 05:30 PM
  4. SQL query
    By zoid in forum Programming Discussion
    Replies: 2
    Last Post: 09-20-2003, 08:56 PM
  5. Replies: 7
    Last Post: 08-06-2001, 02:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •