Bug #73497 [NEW]: memcache session handler with two backend servers Fatal Error (out of memory)

From: Date: Fri, 11 Nov 2016 09:00:12 +0000
Subject: Bug #73497 [NEW]: memcache session handler with two backend servers Fatal Error (out of memory)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205299@lists.php.net to get a copy of this message
From:             php at bof dot de
Operating system: openSUSE 11.4 + 13.1, x86_64
PHP version:      5.6.28
Package:          Session related
Bug Type:         Bug
Bug description:memcache session handler with two backend servers Fatal Error (out of memory)

Description:
------------
Using memcache as session handler. Works with a single backend server,
fails as indicated below when using two backend servers.

This has been working forever, and is in production using 5.6.27 built
the same way as 5.6.28 now. It fails with 5.6.28 on two separate build +
test environments (openSUSE 11.4 + 13.1) using different GCC versions
and external library base, so it is not build environment related.


Test script:
---------------
?php
# ^session CLI ini variables before call:
#
# session.save_handler = files
# session.save_path = "/var/lib/php5"
# session.use_cookies = 1
# session.use_only_cookies = 1
# session.name = PHPSESSID
# session.auto_start = 0
# session.cookie_lifetime = 0
# session.cookie_path = /
# session.cookie_domain =
# session.cookie_httponly = 1
# session.serialize_handler = php
# session.gc_probability = 1
# session.gc_divisor = 1000
# session.gc_maxlifetime = 1440
# session.bug_compat_42 = Off
# session.bug_compat_warn = Off
# session.referer_check =
# session.entropy_length = 32
# session.entropy_file = /dev/urandom
# session.cache_limiter = nocache
# session.cache_expire = 180
# session.use_trans_sid = 0
# session.hash_function = 3
# session.hash_bits_per_character = 5

# these three just for testing, to suppress headers-sent warning
ini_set('session.use_cookies', '0');
ini_set('session.use_only_cookies', '0');
ini_set('session.use_trans_sid', '1');

function test() {
        session_name('SID_bof');
        session_id('abcdef');
        if (!session_start()) {
                var_dump('session_start failed');
                exit(1);
        }
        var_dump($_SESSION);
        $_SESSION['bof.test'] = 42;
        session_write_close();
}

ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', 'tcp://192.168.0.2:11211');
test();
ini_set('session.save_path', 'tcp://192.168.0.3:11211');
test();
ini_set('session.save_path', 'tcp://192.168.0.2:11211,
tcp://192.168.0.3:11211');
test();
?>

Expected result:
----------------
# on second run, otherwise these are empty arrays first
array(1) {
  'bof.test' =>
  int(42)
}
array(1) {
  'bof.test' =>
  int(42)
}
array(1) {
  'bof.test' =>
  int(42)
}

Actual result:
--------------
# on second run, otherwise these are empty arrays
array(1) {
  'bof.test' =>
  int(42)
}
array(1) {
  'bof.test' =>
  int(42)
}

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 4294967160 bytes) in /tmp/badsess.php on line 37

Call Stack:
    0.0001     234880   1. {main}() /tmp/badsess.php:0
    0.0028     253808   2. test() /tmp/badsess.php:52
    0.0028     253856   3. session_start() /tmp/badsess.php:37

-- 
Edit bug report at https://bugs.php.net/bug.php?id=73497&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=73497&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=73497&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=73497&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=73497&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=73497&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=73497&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=73497&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=73497&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=73497&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=73497&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=73497&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=73497&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=73497&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73497&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=73497&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=73497&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=73497&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73497&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=73497&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=73497&r=mysqlcfg



Thread (9 messages)

« previous php.bugs (#205299) next »