php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59225 getStats returns NULL when a server in the pool is down
Submitted: 2010-05-20 16:02 UTC Modified: -
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: thunberg at gmail dot com Assigned:
Status: Open Package: memcached (PECL)
PHP Version: 5.3.2 OS: CentOS 4.8 (x86_64)
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-05-20 16:02 UTC] thunberg at gmail dot com
Description:
------------
I expanded my single memcached server setup to include a pool 
of memcached servers and in the process took a few minutes to 
make a simple status script:

http://esea.net/staff/kane/service_stats.php

The problem is when one server goes down all the operations 
(set, get, etc) continue fine, but getStats returns NULL and 
the result code is Memcached::RES_SOME_ERRORS.

Anyway this could return the normal array of servers, the 
stats for the alive ones, and NULL for any that are down?

Thanks in advance for the help.

Reproduce code:
---------------
$array = array(													array('10.1.1.9', 11211, 25),	// alive
array('10.1.1.13', 11211, 25),	// alive						array('10.1.1.8', 11211, 25),	// alive
array('10.1.1.7', 11211, 25)	// dead
);
$mc->addServers($array);

var_dump($mc->getStats());

Expected result:
----------------
Associative array indexed by host:port with stats for alive 
servers and NULL or some other indication that a server is 
down.

Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-20 20:27 UTC] pep at neanderthal-technology dot com
Tried to reproduce this on 2 different platforms but it worked the way expected 
for 
me:

Platform: Ubuntu 10.04
PHP: 5.3.2
libmemcached: 1.0.2

Platform: CentOS 6.4
PHP: 5.4.15
libmemcached: 1.0.10

Reproduce code:
--------------
$mc = new \Memcached();
$array = array(
array('10.10.10.20', 11211, 25), // up
array('10.10.10.21', 11211, 25), // down
);
$mc->addServers($array);
var_dump($mc->getStats());


Expected result:
---------------
array(
'10.10.10.20:11211' => array(..),
'10.10.10.21:11211' => array(..),
)

Actual result:
---------------
array(
'10.10.10.20:11211' => array('pid' => int(6647), ..),
'10.10.10.21:11211' => array('pid' => int(-1)..),
)

The negative pid indicates the server is unavailable.
 
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Mar 28 09:02:23 2015 UTC