XF 1.3 memcache and compression

Jim Boy

Well-known member
This is possibly the wrong forum, but I'll post here anyway.

I'm trying to get xenforo with memcache running on hhvm but am not getting far (without memcache seems to be fine).

However I get the unexpected error message, the server log has the following:

Code:
ErrorException: Unable to handle compressed values yet - library/Zend/Cache/Backend/Memcached.php:180

#0 (): XenForo_Application::handlePhpError()
#1 /sites/bigfooty/forum/library/Zend/Cache/Backend/Memcached.php(180): Memcache->get()
#2 /sites/bigfooty/forum/library/Zend/Cache/Core.php(303): Zend_Cache_Backend_Memcached->load()
#3 /sites/bigfooty/forum/library/XenForo/Model/DataRegistry.php(87): Zend_Cache_Core->load()
#4 /sites/bigfooty/forum/library/XenForo/Dependencies/Abstract.php(144): XenForo_Model_DataRegistry->getMulti()
#5 /sites/bigfooty/forum/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#6 /sites/bigfooty/forum/index.php(33): XenForo_FrontController->run()
#7 {main}

The "Unable to handle compressed values yet " is thrown up by HHVM from within the memcache module, see line 176 at https://github.com/facebook/hhvm/blob/master/hphp/runtime/ext/ext_memcache.cpp

It seems fairly obvious that the issue is that compression isn't handled by memcache. In my config I am have the following:

Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'bf_';

$config['cache']['backend'] = 'Memcached';
$config['cache']['backendOptions'] = array(
  'compression' => false,
  'servers' => array(
  array(
  // your memcached server IP /address
  'host' => 'xxxxxx.znjku1.cfg.usw2.cache.amazonaws.com',

  // memcached port
  'port' => 11211,
  )
  )
);

I also decided to test the connection with a test script which access the same memcache server through the same installation of HHVM and it worked fine, so its not as if the memcache module is borked.

Having a little bit of a deeper dive, I was able to get the message up once using the test script, which was written in raw php. With memcache::get, the optional second parameter you can pass is a return value, that is if any flag is set in memcache, this will be set. But the only flag you can set is compression, so HHVM assumes that if you asking for a flag by putting in that second parameter, then you may have compression set, and warns you that compression isn't supported. Which then seemingly kills xenforo.

I dont know how that second parameter is being set (eg $memcache->get('key', $flag)), but if it can be removed, then I think that might sort this issue.

Any ideas?
 
The flag that you're pointing to is actually returned by Memcache with the get (https://github.com/facebook/hhvm/blob/master/hphp/runtime/ext/ext_memcache.cpp#L313). So that seems to be implying that the value in Memcache is actually compressed (which is a set-time choice). I'd guess that you need to restart memcache to remove any compressed values.
Wish my C was better, it is odd as that memcache instance has only ever been used by my XF installation. Have now tested against a local memcache as well as a new elasticache and it's coming up just fine. May be some errant add-on . I'll flush the current memcache, or even delete everything.

Thanks for the help
 
Top Bottom