My Homepage has a Problem with memcache. It works only for some hours and the it gives a lot letter back.

When I killed memcache, everything works. The errror comes only on the first page and not on subpages.

My enviroment:
Lighttp 1.4.19, PHP 5.2.6 with APC and Memcache, Mysql5, AMD64 maschine with Ahtlon X64 X2 6000+ and 8 GB RAM, Drupal 5.7 and a lot of modules. OS is Debian Lenny 64Bit

Some pictures:
Everything is normal

Memcache brokes the Start Page

Anyone has an idea, what happens?


bennos’s picture

sorry forgotten the JPG with the error.


I hope anyone has an idea.


bennos’s picture

The Screenshot Links does not work, so I have uploaded it to my Site.

Screenshot normal with Memcache works right:

Screenshot with crashed Startpage.

robertDouglass’s picture

Priority: Critical » Normal

Interesting. The screenshot you show reminds me of what one sees when you get a compressed page back (used to happen when both Drupal and apache compressed). Memcache also compresses. As an experiment you can try using no compression with memcache. In dmemcache.inc there is this function:

function dmemcache_set($key, $value, $exp = 0, $bin = 'cache') {
  global $_memcache_statistics;
  $_memcache_statistics['set'][] = $key;
  $_memcache_statistics['bins'][] = $bin;
  if ($mc = dmemcache_object($bin)) {
    $full_key = dmemcache_key($key, $bin);
    if (!$mc->set($full_key, $value, TRUE, $exp)) {
      watchdog('memcache', 'Failed to set key: ' . $full_key, WATCHDOG_ERROR);
    else {
      return TRUE;
  return FALSE;

Try changing the line if (!$mc->set($full_key, $value, TRUE, $exp)) { to if (!$mc->set($full_key, $value, FALSE, $exp)) { and see if that makes a difference.

Are you using any other cache related modules (like advcache)?

bennos’s picture

thx Robert. I will try it out and give you feedback.

I also uses Advcache. My Enviroment is above.

I trying to find out what happens and where it happens. I have splitted memcache in several daemons and I assigned to every daemon a different "Bin". When I get the next error, I can shut down memcache daemons step by step.

bennos’s picture

I have changed the line, but my line was a bit different.

if (!$mc->set($full_key, $value, MEMCACHE_COMPRESSED, $exp)) {

Changing MEMcache_compressed to false, make no difference.

I have looked at my PHP Config. Only typically Modules are installed, but zlib compression is on.
Could it be a problem?!?

bennos’s picture

Problem solved.

the zlib libary was activated in the php.ini. I tried my old memcache configuration and deactivated zlib compression in php.
Everything works fine now for 2 days.

I think there shoul be an advise in the install.txt or readme.txt that PHP zlib an Memcache with compressing should not be activated at the same time.


robertDouglass’s picture

Status: Active » Fixed

Thanks. Reported on the project page and in the README.txt.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

asb’s picture

Version: 5.x-1.7 » 6.x-1.4
Status: Closed (fixed) » Active


I have zlib compression activated in my /etc/php5/apache2/php.ini (Debian GNU/Linux "Lenny"):

zlib.output_compression = On
zlib.output_handler = On

But in 6.x-1.4 I've never encountered any problems like described in the issue for 5.x

Could someone verify if this incompatibility is still an issue?

Thanks & greetings, -asb

Terko’s picture

I have the same problem, but it happens when I clear the caches. Then the CSS of the first page didn't load proper and I need to flush Memcache to fix it. I don'thave zlip.output turned on.

bennos’s picture

from 2008. now an stable D6 version and a lot of progress in the memcache Base, It could have not more any effects with zlib On/Off.

check your settings and versions of memcache or memcached pecl and memcached daemons. there are some problem and you must find a stable setup und config.
try it out.

Jeremy’s picture

Status: Active » Fixed

I suspect this was an issue with Memcache's lack of wildcard support. In other words, I do not expect this to be an issue any longer.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.