If using memcache.inc and the memcache daemon goes away, millions of watchdog entries mean instant death of the database:


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)) {
///// DATABASE DEATH!!!
      watchdog('memcache', 'Failed to set key: ' . $full_key, WATCHDOG_ERROR);
    }
    else {
      return TRUE;
    }
  }
  return FALSE;
}
CommentFileSizeAuthor
#3 dmemcache.inc_.338522.patch680 bytesjaydub

Comments

jvandyk’s picture

I think the code you cite is from the 5.x branch? In the 6.x branch of dmemcache.inc, the code has been changed because, with multiple watchdog implementations possible (dblog, syslog, etc) watchdog is not online early enough for the recording to be done anyway. (See issue for that here: http://drupal.org/node/319844). In the 6.x branch dmemcache_set() is as follows:

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, MEMCACHE_COMPRESSED, $exp)) {
      return FALSE;
    }
    else {
      return TRUE;
    }
  }
  return FALSE;
}
robertdouglass’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev

Yes. My mistake. Was looking over my client's shoulder while filing the report.

jaydub’s picture

Status: Active » Needs review
StatusFileSize
new680 bytes

rolled the one-liner patch for d5.

robertdouglass’s picture

Status: Needs review » Fixed

committed it to DRUPAL-5. Thanks.

Status: Fixed » Closed (fixed)

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