• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Service issue Memcache Based Session Fails If Any ("Redundant") Server Is Down

digitalpoint

Well-known member
#1
Memcache has built in fault tolerance via the PHP extension's addServer() connection pool (which Zend/XF uses just fine).

If any one memcache server is down, the XF's session causes a fatal error even though nothing is actually wrong on the backend end (again... the PHP extension handles failover of the memcache cluster internally).

It looks like the Zend_Session class already has the ability to not fail on a startup exception (more specifically in this case I believe it's a PHP notice that's being treated as a fatal exception). Info on the same issue here: http://framework.zend.com/issues/browse/ZF-6848

It looks like the two session start lines in XenForo_Session could be changed to this (since the start() method already allows passing in the throw_startup_exceptions option):

PHP:
$session->start(array('throw_startup_exceptions' => E_ALL ^ E_NOTICE));
Long story short is if one memcache server goes down, the failover is already handled in PHP, but XF will end up with fatal error for any page the way it is now.
 

Mike

XenForo developer
Staff member
#2
The workaround here is to specify a failure_callback with an empty function in the configuration of the servers. Otherwise, the memcache library itself issues a notice which ends up getting caught by our error handling.

I'd recommend the failure_callback setting.
 

HWS

Well-known member
#3
Adding
Code:
'failure_callback' => ''
to the memcache config in config.php
results in an error.

Is there a better way to add failure_callback correctly?