ID: 51091
Updated by: [email protected]
Reported By: achristianson at yakabod dot com
Status: Open
Bug Type: Reproducible crash
Operating System: CentOS 5.4
PHP Version: 5.3.1
New Comment:
Looks like a gc issue. Confirm by setting:
zend.enable_gc = Off
in your php.ini
Previous Comments:
------------------------------------------------------------------------
[2010-02-19 15:29:20] achristianson at yakabod dot com
Description:
------------
* create persistent connection to database; store it to a variable
* create an additional persistent connection to database: store it in
the same variable
* allocate a bunch of memory
* PHP segfaults
Reproduce code:
---------------
<?php
$db = connect();
$db = connect();
for($i = 0; $i < 10000; $i++)
{
$exampleArray[] = new ExampleObject();
}
class ExampleObject { }
function connect()
{
return new PDO( 'mysql:host=<db host>;dbname=<db name>', '<db user>',
'<db password>',
array( PDO::ATTR_PERSISTENT => true ));
}
Expected result:
----------------
no segmentation fault
Actual result:
--------------
[New Thread 0xb7f396c0 (LWP 3416)]
Program received signal SIGSEGV, Segmentation fault.
0x0853a746 in zobj_mark_grey (obj=0xb7b8e07c, pz=0xbfd1f0c8) at
/root/php-5.3.1/Zend/zend_gc.c:383
383 p = Z_OBJPROP_P(pz)->pListHead;
(gdb) bt
#0 0x0853a746 in zobj_mark_grey (obj=0xb7b8e07c, pz=0xbfd1f0c8) at
/root/php-5.3.1/Zend/zend_gc.c:383
#1 0x0853a81e in gc_mark_roots () at /root/php-
5.3.1/Zend/zend_gc.c:410
#2 0x0853af64 in gc_collect_cycles () at /root/php-
5.3.1/Zend/zend_gc.c:628
#3 0x0853a1a9 in gc_zobj_possible_root (zv=0xa06bac8) at /root/php-
5.3.1/Zend/zend_gc.c:221
#4 0x08539f78 in gc_zval_possible_root (zv=0xa06bac8) at /root/php-
5.3.1/Zend/zend_gc.c:143
#5 0x08508570 in _zval_ptr_dtor (zval_ptr=0xbfd1f1ec,
__zend_filename=0x88fb070 "/root/php-5.3.1/Zend/zend_vm_execute.h",
__zend_lineno=28199) at /root/php-5.3.1/Zend/zend_gc.h:183
#6 0x085d7d24 in ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER
(execute_data=0x9cccd20) at /root/php-
5.3.1/Zend/zend_vm_execute.h:28199
#7 0x08543e68 in execute (op_array=0x9d12f70) at /root/php-
5.3.1/Zend/zend_vm_execute.h:104
#8 0x08518b68 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /root/php-5.3.1/Zend/zend.c:1194
#9 0x084aecdb in php_execute_script (primary_file=0xbfd216a4) at
/root/php-5.3.1/main/main.c:2225
#10 0x085e4fa0 in main (argc=2, argv=0xbfd21804) at /root/php-
5.3.1/sapi/cli/php_cli.c:1190
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51091&edit=1