php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68616 memcache call fallback only once
Submitted: 2014-12-17 10:35 UTC Modified: 2021-03-25 16:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:-1 (-100.0%)
From: tom916 at qq dot com Assigned: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 5.5.19 OS: Linux app10-116 3.8.0-34-generic
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:
Package:
Bug Type:
Summary:
From: tom916 at qq dot com
New email:
PHP Version: OS:

 

 [2014-12-17 10:35 UTC] tom916 at qq dot com
Description:
------------
memcache call fallback only once 

Test script:
---------------
?php

function fail(){
    print_r(func_get_args());
}



function foo(){
    $mem = new Memcache();
    $server = array(
        'host'=>'8.8.8.8',
        'port'=>'11211',
        'persistent'=>1
    );


    $mem->addServer($server['host'],$server['port'],$server['persistent'],1,1,15,true,'fail');
    $mem->get('xx');
}


foo();
echo "over 1\n";
foo();
echo "over 2\n";

Expected result:
----------------
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
over 1
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
over 2

Actual result:
--------------
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
over 1
over 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-28 00:46 UTC] chuanm at gmail dot com
This may not be a bug.

The memcache library should cache the failed server list and won't retry it in 15 seconds because retry_interval is set to 15 seconds while calling Memcache::addServer() (http://php.net/manual/en/memcache.addserver.php). When I changed that line to force memcache to always try the failed server (by passing 0 seconds to retry_interval), it works as expected.

  $mem->addServer($server['host'],$server['port'],$server['persistent'],1,1,0,true,'fail');



Actual result:
---------------
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
over 1
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
Array
(
    [0] => 8.8.8.8
    [1] => 11211
    [2] => 0
    [3] => Connection timed out
    [4] => 110
)
over 2
 [2021-03-25 16:37 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:37 UTC] cmb@php.net
The official bug tracker for PECL/memcache is now at
<https://github.com/websupport-sk/pecl-memcache/issues>.

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC