From: jarismar_silva at adplabs dot com dot br Operating system: Windows XP SP2 PHP version: 5.2.6RC3 PHP Bug Type: PDO related Bug description: Apache crashes with PDO_OCI and both persistent and non-persistent connectios
Description: ------------ Sometimes our DBAs restart oracle without restarting the apache server, due to this if apache has persistent connections, those connections are in invalid state. In this scenario trying to connect to oracle results in on of the following errors: ORA-00028: your session has been killed ORA-01012: not logged on ORA-03113 end-of-file on communication channel I'm trying to handle this errors and skipping creating the persistent connection and then creating a new non-persistent connection (see the php snippet). I was in hope that doing this could force apache to free the invalid persistent connection, but instead apache crashes (it seems a problem freeing the statements). Reproduce code: --------------- try { $oPDO = new PDO($sDSN, $sUserName, $sPassword, array(PDO::ATTR_PERSISTENT => true)); print "Persistent connection created\n"; $oPDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $oE) { echo "Error : ".$oE->getMessage()."\n"; $oPDO = new PDO($sDSN, $sUserName, $sPassword, array(PDO::ATTR_PERSISTENT => false)); print "Non persistent connection created\n"; } try { $oStatement = $oPDO->prepare('Select 1+1 as test from dual'); var_dump($oStatement->execute()); var_dump($oStatement->fetchAll()); } catch (Exception $oE) { echo "Error : ".$oE->getMessage()."\n"; } $oPDO = null; Expected result: ---------------- I expect either the system get ride of invalid persistent connections or when one create a non-peristent connection it replaces the persistent one if there is any. Actual result: -------------- Unhandled exception at 0x0087ac76 (php5ts.dll) in Apache.exe: 0xC0000005: Access violation reading location 0x002b5ffc. > php5ts.dll!_zend_mm_free_int(_zend_mm_heap * heap=0x01ded100, void * p=0x0005000c) Line 1960 C php5ts.dll!_efree(void * ptr=0x00265ff8) Line 2293 + 0xb bytes C php_pdo_oci.dll!oci_stmt_dtor(_pdo_stmt_t * stmt=0x00000000, void * * * tsrm_ls=0x01debeb0) Line 90 + 0x3 bytes C php_pdo.dll!free_statement(_pdo_stmt_t * stmt=0x02b9ad48, void * * * tsrm_ls=0x01debeb0) Line 2355 + 0x8 bytes C php_pdo.dll!php_pdo_stmt_delref(_pdo_stmt_t * stmt=0x02b9ad48, void * * * tsrm_ls=0x01debeb0) Line 2397 + 0xb bytes C php_pdo.dll!pdo_dbstmt_free_storage(_pdo_stmt_t * stmt=0x02b9ad48, void * * * tsrm_ls=0x01debeb0) Line 2402 + 0xf bytes C php5ts.dll!zend_objects_store_del_ref_by_handle(unsigned int handle=2, void * * * tsrm_ls=0x01debeb0) Line 206 + 0x11 bytes C php5ts.dll!zend_objects_store_del_ref(_zval_struct * zobject=0x02b9ab00, void * * * tsrm_ls=0x01debeb0) Line 169 C php5ts.dll!_zval_dtor_func(_zval_struct * zvalue=0x02b9ab00) Line 60 C php5ts.dll!_zval_ptr_dtor(_zval_struct * * zval_ptr=0x02b9aefc) Line 414 + 0xc bytes C php5ts.dll!zend_hash_apply_deleter(_hashtable * ht=0x01e22460, bucket * p=0x02b9aef0) Line 611 + 0x6 bytes C php5ts.dll!zend_hash_reverse_apply(_hashtable * ht=0x01e22460, int (void *, void * * *)* apply_func=0x00907bb0, void * * * tsrm_ls=0x01debeb0) Line 760 + 0xb bytes C php5ts.dll!shutdown_destructors(void * * * tsrm_ls=0x01debeb0) Line 212 C php5ts.dll!zend_call_destructors(void * * * tsrm_ls=0x01debeb0) Line 845 + 0x6 bytes C php5ts.dll!php_request_shutdown(void * dummy=0x00000000) Line 1445 + 0x6 bytes C php5apache2.dll!php_apache_request_dtor(request_rec * r=0x01bc6de0, void * * * tsrm_ls=0x01debeb0) Line 468 + 0x8 bytes C php5apache2.dll!php_handler(request_rec * r=0x01bc6de0) Line 641 + 0x7 bytes C libhttpd.dll!6ff01575() [Frames below may be incorrect and/or missing, no symbols loaded for libhttpd.dll] libhttpd.dll!6ff019fd() libhttpd.dll!6ff0e15c() libhttpd.dll!6ff09966() libhttpd.dll!6ff04275() libhttpd.dll!6ff044f2() libhttpd.dll!6ff1c3b8() msvcr71.dll!7c36b381() ntdll.dll!7c91849f() msvcr71.dll!7c3638e2() kernel32.dll!7c80b683() ntdll.dll!7c91849f() -- Edit bug report at http://bugs.php.net/?id=44560&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44560&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44560&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44560&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44560&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44560&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44560&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44560&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44560&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44560&r=support Expected behavior: http://bugs.php.net/fix.php?id=44560&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44560&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44560&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44560&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44560&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44560&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44560&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44560&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44560&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44560&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44560&r=mysqlcfg