|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59270 failover doesn't work
Submitted: 2010-06-17 12:07 UTC Modified: 2012-03-07 17:36 UTC
From: somnium at ukr dot net Assigned: andrei (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.2.4 OS: Ubuntu 8.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: somnium at ukr dot net
New email:
PHP Version: OS:


 [2010-06-17 12:07 UTC] somnium at ukr dot net
If one of two memcached servers is down - system do not selects working memcached server.
In reproduce code server2 is down and server1 is OK. If we remove server2 from $memcache->addServers() method - then code works OK.

ОS: Ubuntu 8.04
Repcached: 2.2
PECL Memcached: 1.0.2
libmemcached: 0.40
PHP: 5.2.4

Reproduce code:
$memcache = new Memcached();

$memcache->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$memcache->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);

// server2 is down and server1 is OK.
$memcache->addServers(array('server1', 11211), array('server2', 11211));

$memcache->set('var1', 'qwerty');
echo $memcache->get('var1');

Expected result:
Must be shown "qwerty"

Actual result:
Nothing shown. (getResultCode() returns RES_WRITE_FAILURE = 5)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-17 12:47 UTC]
Thank you for taking the time to write to us, but this is not
a bug.

libmemcached does not do failover like this by default. You 
can use replication with pecl/memcached that's in master 
branch on Github though.
 [2010-06-18 04:08 UTC] somnium at ukr dot net
And I also want to mention that if in servers pool will be server that is down then method Memcached::getStats() will return error.
 [2010-06-18 04:09 UTC] somnium at ukr dot net
Hmmm...I'm not realy understood you.
I've using repcached for replicating data between servers. I'd run server2 as master and server1 as a slave (made test via telnet to check data replicates correctly). Then I'd put down server2(master) and tried to run my test code with server1 and server2 in pool - and I got error RES_WRITE_FAILURE. But I expects that memcached chooses a different server...
Anyway, if libmemcached does not do failover - for what purposes there is options like OPT_RETRY_TIMEOUT, OPT_SERVER_FAILURE_LIMIT? It seems I don't understand something...
 [2010-06-18 08:25 UTC] somnium at ukr dot net
I reopened this issue. Please see my two previous comments.
 [2010-06-18 12:54 UTC]
pecl/memcached is a pretty thin wrapper on top of 
libmemcached, so you'd be better off asking these questions 
on libmemcached mailing list. Here's the meaning of the 
settings you're asking about (from manpages):

           This number of times a host can have an error 
before it is disabled.

           When enabled a host which is problematic will 
only be checked for usage based on the amount of
           time set by this behavior.
 [2012-03-07 17:36 UTC]
Closing because of age. Please try version 2.0.1 and reopen if this still occurs.
 [2012-03-07 17:36 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: andrei
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 08:01:31 2024 UTC