Upgrade php-memcache extension to 3.0.8 or downgrade to 2.2.6
TL;DR: Update php-memcache extension to at least 3.0.8 or downgrade to 2.2.6. This can haunt Drupal sites using features especially and is quite hard to track down and leads to very instable system behavior.
Several Drupal sites of a friend of mine have been plagued by a vague bug, which led to very "interesting" site behavior.
The least concern was that exported indexes suddenly disappeared, but on another site the whole exported rules did suddenly not work anymore and such the whole business logic of the site failed, which was obviously a major problem for my friend. Problematic was also that the problem disappeared then after an apache restart, but happened again months later.
Just clearing the cache solved the problem in both cases, so cache corruption was the most likely.
This bug is described in the PHP bug tracker in the following bug reports:
The former has a good description of the bug report, but the second one uses valgrind to "see" the bug.
Both instances ran php-memcache 3.0.6, but this bug is just fixed in 3.0.8.
So on ubuntu I added the corruption.php to a file:
<?php
$obj = new StdClass();
$obj->obj = $obj;
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211);
$memcache->set('x', $obj, false, 300);
$x = $memcache->get('x');
$x = $memcache->get('x');
installed and ran valgrind
apt-get install valgrind
$ valgrind --tool=memcheck php corruption.php
and got several errors. I updated to 3.0.8 manually and got no more errors.
Drupal is affected by this bug in several ways and I found corruption in search API search indexes and rules at least. There might be more.
Unfortunately for Ubuntu no new packages for 3.0.8 do exist, so I upgraded manually by compiling the source to 3.0.8. Hopefully new packages come out soon.
It is fixed for RHEL and CentOS though.
I am blogging about this, because cache corruption can have very problematic side effects for Drupal sites. From failing features (suddenly a feature is overridden), missing functionality (certain rules no longer triggered) or whole pages disappearing, different things can happen. And this bug can be very hard to track down.
So upgrade or downgrade your packages and enjoy stable production systems.
Thanks,
Fabian