| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 11:00:01 2025 UTC | 
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.