ID: 44560 Updated by: [email protected] Reported By: jarismar_silva at adplabs dot com dot br -Status: Open +Status: Feedback Bug Type: PDO related Operating System: Windows XP SP2 PHP Version: 5.2.6RC3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2008-03-28 15:57:17] jarismar_silva at adplabs dot com dot br You can more reproduce this error by killing the persistent connection. First you need to discovering the SID and Serial# from the persistent connection in order to kill it: This SQL retrieve SID and SERIAL# : select * from ( select nvl(ses.USERNAME,'ORACLE PROC') username, PROGRAM, MACHINE, ses.status status, PROCESS pid, ses.SID SID, SERIAL# from v$session ses, v$sess_io sio where ses.SID = sio.SID order by PHYSICAL_READS, ses.USERNAME ) where username = 'RPTDEV7' order by machine, pid, sid Then kill the session with ALTER SYSTEM KILL SESSION '<SID>,<SERIAL#>'; ------------------------------------------------------------------------ [2008-03-28 14:53:42] jarismar_silva at adplabs dot com dot br 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 this bug report at http://bugs.php.net/?id=44560&edit=1
