Upgrade Memcached Before WordPress

Self-hosted WordPress and WordPress MU administrators: if you are using the memcached object cache (a prerequisite for batcache), upgrade it before upgrading WordPress. There is a bug that keeps the old db_version in the options cache, preventing WordPress from remembering that it has been upgraded, and this causes it to ask you to upgrade again. In a pinch you can resolve the problem by restarting the memcached daemon.

The memcached object cache can’t be automatically upgraded because it’s not a normal plugin. Make sure to use the right version: 1.0 (sockets) or 2.0 (PECL). Only one line was changed, so you might prefer to update by hand: 1.0, 2.0.

If you aren’t sure whether you are using memcached, look for a file named object-cache.php in wp-content. If that file exists, look inside to see if the plugin name is “Memcached”.

Leave a comment

8 Comments

  1. We just came across this last week. Our solution was simpler… we just keep a UNIX time stamp version number for each blog and integrate that into our keys. We have the flush() method update that to the current time (we can also flush a specific blog by passing a special query string parameter to it via HTTP).

    Reply
  2. I have problems with memcached and wordpress, i have 10 blogs with wordpress. If active memcached for wordpress only cache the fisrt blog, and other blogs show the first blog cached ?? Why ?? I need help.

    Reply
  3. I found object-cache.php in wp-content and found the word “memcached” therein. Now, how do I determine if I am using SOCKETS or PECL so I know which way to upgrade?

    Also, can I perform this memcached upgrade BEFORE installing 2.7 (ie: with 2.6.2 still installed), or must I wait until 2.7?

    Reply
  4. Upon further investigation, I think I’ve got a stale object-cache.php file, the header of which is below. Does this shed any light?

    /*
    Name: APC Cache
    Description: APC backend for the WP Object Cache.
    Version: 0.2
    URI: http://txfx.net/code/wordpress/apc-cache/
    Author: Mark Jaquith

    Install this file to wp-content/object-cache.php

    Big thanks to Ryan Boren (http://boren.nu/) whose Memcached backend plugin
    made the writing of this plugin a 5 minute operation.
    */

    Reply
  5. Mark Jaquith: That’s very similar to what I proposed in Cache with Versioned Tags. I used a cached integer instead of a date, then I used the memcached increment function to “flush” the cache. This really belongs in the plugin…

    Drew: That’s not the memcached plugin. You have something else. I’ve updated the post to be more helpful in that case.

    Reply
  6. Hi Andy and thank you for this cache plugin!

    I would like to ask you if you know why apache is having segmentation faults if i copy the object-cache.php (2.0 PECL) to wp-content.

    The steps:

    - installed memcache daemon
    - installed php-pecl-memcache
    - edited wp-config and added 2 lines:
    global $memcached_servers;
    $memcached_servers = array(‘default’ => array(’127.0.0.1:11211′));

    - copy object-cache.php to wp-content

    and then apache starts with segmentation faults. A lot….

    I don’t know if i forgot any step :)

    Thanks again!

    Reply
  7. Luke

     /  March 12, 2009

    I’ll have to “second” Fernando above, from Feb 3rd as well.

    Once the object-cache is turned on, it starts seg faulting like crazy.

    I did track it down a bit, to find out one source of the cause.
    First, the setup.
    - Apache 2.2.6
    - PHP 5.2.6
    - MySQL 5.0.45
    - Memcached 1.2.6
    - PECL Memcached Extension: 2.2.5
    - WordPress MU (Subdomain mode)

    For whatever reason, it appears that on occasion certain file uploads within the blogs.dir will produce corrupted results, thus causing a seg fault (and a zend_mm_heap corrupt as well).

    That’s as far as I’ve got with it, as I hit google to look for any others with this problem and this just happened to be the first result.

    So whether it’s something within blogs.php that’s causing it, the rewrite rule for files, etc, I’m not sure. At the moment, the files which error out seem to be at random. As an aside, the actual image files are fine, as they serve right up once the object cache is disabled.

    I may try the non-PECL branch as an alternative, and see if the results are similar in order to troubleshoot a bit and try to narrow it down. If I find anything, I’ll pass it along.

    Reply
  8. Luke

     /  March 12, 2009

    Just to follow up, I switched to the 1.0 branch and after 15 minutes it hasn’t exhibited any seg faults or mm_heap corrupt errors. I’ll keep my fingers crossed.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 1,664 other followers

%d bloggers like this: