Bug #73497 [Com]: memcache session handler with two backend servers Fatal Error (out of memory)
| From: | php at bof dot de | Date: | Fri, 11 Nov 2016 09:16:03 +0000 |
| Subject: | Bug #73497 [Com]: memcache session handler with two backend servers Fatal Error (out of memory) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205300@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73497&edit=1
ID: 73497
Comment by: php at bof dot de
Reported by: php at bof dot de
Summary: memcache session handler with two backend servers
Fatal Error (out of memory)
Status: Open
Type: Bug
Package: Session related
Operating System: openSUSE 11.4 + 13.1, x86_64
PHP Version: 5.6.28
Block user comment: N
Private report: N
New Comment:
Additional information: the memcache module is from https://git.php.net/repository/pecl/caching/memcache.git
checked out with tag memcache-3.0.8 - source files are identical between my 5.6.27 (works) and
5.6.28 (breaks) builds.
Previous Comments:
------------------------------------------------------------------------
[2016-11-11 09:00:01] php at bof dot de
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 this bug report at https://bugs.php.net/bug.php?id=73497&edit=1