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: 2021-06-09 11:24 UTC
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: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.2 OS: CentOS 4.8 (x86_64)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: thunberg at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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.
 [2021-06-09 11:24 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:24 UTC] cmb@php.net
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <https://github.com/php-memcached-dev/php-memcached/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC