From: achristianson at yakabod dot com
Operating system: CentOS 5.4
PHP version: 5.3.1
PHP Bug Type: Reproducible crash
Bug description: Persistent PDO Connections Crash
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 bug report at http://bugs.php.net/?id=51091&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51091&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51091&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51091&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51091&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51091&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51091&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51091&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51091&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51091&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51091&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51091&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51091&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51091&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51091&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51091&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51091&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51091&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51091&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51091&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51091&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51091&r=mysqlcfg