|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59151 session_redundancy + 2 servers + 1 offline = segfault
Submitted: 2010-04-09 09:51 UTC Modified: 2010-04-10 08:58 UTC
From: abodera at gmail dot com Assigned:
Status: Duplicate Package: memcache (PECL)
PHP Version: 5.3.2 OS: Fedora 10
Private report: No CVE-ID: None
 [2010-04-09 09:51 UTC] abodera at gmail dot com
When using latest SVN of NON_BLOCKING_IO with session_redundancy and one of the servers fails, a segfault occurs.

Note that session_redundancy of 2 makes session handler NOT write to both servers (another bug), even if both are alive. Setting session_redundancy to 3 makes it work as expected -  session handler writes a copy of session data to both servers.

Unfortunatelly, just after one of the servers is not available, a warning + segfault is thrown.

Reproduce code:
---~----~----~- memcache.ini ---~----~----~-

---~----~----~- php code ---~----~----~----~----
php -r 'session_start();'

Expected result:
Working with one server.

Actual result:
PHP Warning:  Unknown: Failed to write session data (memcache). Please verify that the current setting of session.save_path is correct (tcp://,tcp:// in Unknown on line 0
Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-09 10:14 UTC] tony at daylessday dot org
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2010-04-09 10:18 UTC] pierre dot php at gmail dot com
Duplicate of #13623
 [2010-04-09 11:08 UTC] abodera at gmail dot com
Same happens under 5.3.2 - Debugged there:

Starting program: /usr/bin/php -r 'session_start();'
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
zend_mm_add_to_free_list (heap=<value optimized out>, mm_block=0xb14e70) at /usr/src/debug/php-5.3.2/Zend/zend_alloc.c:767
767                                             prev->next_free_block = next->prev_free_block = mm_block;
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.23-8.fc12.x86_64 keyutils-libs-1.2-6.fc12.x86_64 libcurl-7.19.7-7.fc12.x86_64 libidn-1.9-5.x86_64 libselinux-2.0.90-5.fc12.x86_64 libssh2-1.2.4-1.fc12.x86_64 mysql-libs-5.1.44-1.fc12.x86_64 nspr-4.8.4-2.fc12.x86_64 nss-3.12.6-1.2.fc12.x86_64 nss-softokn-3.12.4-15.fc12.x86_64 nss-softokn-freebl-3.12.4-15.fc12.x86_64 nss-util-3.12.6-1.fc12.x86_64 openldap-2.4.19-3.fc12.x86_64 php-pecl-apc-3.1.3p1-1.fc12.x86_64 sqlite-3.6.20-1.fc12.x86_64
(gdb) bt
#0  zend_mm_add_to_free_list (heap=<value optimized out>, mm_block=0xb14e70) at /usr/src/debug/php-5.3.2/Zend/zend_alloc.c:767
#1  0x0000000000584730 in _zend_mm_free_int (heap=0x9232b0, p=0xb14e80) at /usr/src/debug/php-5.3.2/Zend/zend_alloc.c:2032
#2  0x00007ffff014b0ca in mmc_pool_free (pool=0xb148f8) at /root/NON_BLOCKING_IO/memcache_pool.c:925
#3  0x00007ffff0152201 in ps_close_memcache (mod_data=0x91df00) at /root/NON_BLOCKING_IO/memcache_session.c:185
#4  0x00000000004b1065 in php_session_save_current_state () at /usr/src/debug/php-5.3.2/ext/session/session.c:601
#5  php_session_flush () at /usr/src/debug/php-5.3.2/ext/session/session.c:1489
#6  0x00000000004b134b in zm_deactivate_session (type=<value optimized out>, module_number=<value optimized out>) at /usr/src/debug/php-5.3.2/ext/session/session.c:2143
#7  0x00000000005a2ffc in module_registry_cleanup (module=<value optimized out>) at /usr/src/debug/php-5.3.2/Zend/zend_API.c:2150
#8  0x00000000005ad3a4 in zend_hash_reverse_apply (ht=0x922840, apply_func=0x5a2fe0 <module_registry_cleanup>) at /usr/src/debug/php-5.3.2/Zend/zend_hash.c:755
#9  0x00000000005a1a6d in zend_deactivate_modules () at /usr/src/debug/php-5.3.2/Zend/zend.c:866
#10 0x00000000005502ad in php_request_shutdown (dummy=<value optimized out>) at /usr/src/debug/php-5.3.2/main/main.c:1607
#11 0x0000000000629ba4 in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/php-5.3.2/sapi/cli/php_cli.c:1373
 [2010-04-09 11:14 UTC] abodera at gmail dot com
Same happens on pecl ver 3.0.4
 [2010-04-09 12:13 UTC] pierre dot php at gmail dot com
Please do not reopen this bug. There is no need to have two reports about the same issue.
 [2010-04-10 08:58 UTC] abodera at gmail dot com
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 18:01:24 2023 UTC