Bug #77056 [NEW]: with memcache pool, on a session key miss, other servers not checked
| From: | aleksandar dot kuktin at infostud dot com | Date: | Thu, 25 Oct 2018 09:56:29 +0000 |
| Subject: | Bug #77056 [NEW]: with memcache pool, on a session key miss, other servers not checked | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217676@lists.php.net to get a copy of this message | ||
From: aleksandar dot kuktin at infostud dot com
Operating system: Ubuntu
PHP version: 7.3.0RC3
Package: Session related
Bug Type: Bug
Bug description:with memcache pool, on a session key miss, other servers not checked
Description:
------------
Using memcache extension with failover.
Regression first discovered on upgrade from PHP-5.6 to PHP-7.0, still
persists in PHP-7.3.0RC3.
When using a memcache pool for HA storage of session data, as memcache
does not have replication, a workaround is used. First, PHP stores the
identical session data to all members of a pool. Second, reads are
iterated over all members of a pool until either one is found with
session data or all members are found to not contain data - which means
data doesn't exist. Thus, in the event of a failure and loss of data on
a subset of nodes, they are slowly repopulated as a side-effect of
normal application operation, preventing data loss in all but most
extreme circumstances.
This feature fails to materialize since PHP-7.0.
It may be important to note this feature also fails to materialize if
using the memcached extension; it only works if using the (very old)
memcache extension.
Since PHP-7.0, reads are attempted only once, and if the first node in a
pool does not contain data, this is treated as if data doesn't exist -
yet it does on other nodes in the pool.
As for the specifics, we believe we have excluded the memcache extension
itself. We are using Ondrej's PPA repo for PHP, and with it we are using
the exact same deb package (SHA256 match) for php-memcache on both
PHP-5.6 and PHP-7. Issue present on both Ubuntu-14.04 and Ubuntu-16.04
(18.04 not test as of yet).
Test script:
---------------
<?php
session_start();
if (array_key_exists("opennum", $_SESSION)) {
$myses = $_SESSION["opennum"];
} else {
$myses = 0;
}
$_SESSION["opennum"] = $myses + 1;
echo "success? myses = ${myses}\n";
// wget it repeatedly
Expected result:
----------------
Commands issued (>), responses sent (<) to/from memcache servers by
PHP-5.6:
SERVER 0
> incr mbbh79abrh9758v87pbjj012k3.lock 1
< NOT_FOUND
> add mbbh79abrh9758v87pbjj012k3.lock 768 15 1
> 1
< STORED
> get mbbh79abrh9758v87pbjj012k3
< END
> set mbbh79abrh9758v87pbjj012k3 0 86400 12
> opennum|i:1;
< STORED
> set mbbh79abrh9758v87pbjj012k3.lock 768 15 1
> 0
< STORED
SERVER 1
> incr mbbh79abrh9758v87pbjj012k3.lock 1
< NOT_FOUND
> add mbbh79abrh9758v87pbjj012k3.lock 768 15 1
> 1
< STORED
> get mbbh79abrh9758v87pbjj012k3
< END
> set mbbh79abrh9758v87pbjj012k3 0 86400 12
> opennum|i:1;
< STORED
> set mbbh79abrh9758v87pbjj012k3.lock 768 15 1
> 0
< STORED
Actual result:
--------------
Commands issued (>), responses sent (<) to/from memcache servers by
PHP-7.0, PHP-7.1, PHP-7.2 and PHP-7.3.0RC3:
SERVER 0
> incr a4126f4585d5fc35dcff6b21c6fddabb.lock 1
< NOT_FOUND
> add a4126f4585d5fc35dcff6b21c6fddabb.lock 768 15 1
> 1
< STORED
> get a4126f4585d5fc35dcff6b21c6fddabb
< END
> set a4126f4585d5fc35dcff6b21c6fddabb 0 86400 12
> opennum|i:1;
< STORED
> set a4126f4585d5fc35dcff6b21c6fddabb.lock 768 15 1
> 0
< STORED
SERVER 1
> set a4126f4585d5fc35dcff6b21c6fddabb 0 86400 12
> opennum|i:1;
< STORED
> set a4126f4585d5fc35dcff6b21c6fddabb.lock 768 15 1
> 0
< STORED
--
Edit bug report at https://bugs.php.net/bug.php?id=77056&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77056&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77056&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77056&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77056&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77056&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77056&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77056&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77056&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77056&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77056&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77056&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77056&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77056&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77056&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77056&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77056&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77056&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77056&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77056&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77056&r=mysqlcfg