|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44560 Apache crashes with PDO_OCI and both persistent and non-persistent connections.
Submitted: 2008-03-28 14:53 UTC Modified: 2016-03-08 01:43 UTC
From: jarismar dot php at gmail dot com Assigned: mbeccati (profile)
Status: No Feedback Package: PDO OCI
PHP Version: 5.2.6RC3 OS: Windows XP SP2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-03-28 14:53 UTC] jarismar dot php at gmail dot com
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";
} 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');
} 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
 	[Frames below may be incorrect and/or missing, no symbols loaded for libhttpd.dll]	


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-28 15:57 UTC] 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  (
  nvl(ses.USERNAME,'ORACLE PROC') username,
  ses.status status,
	ses.SID SID,
from	v$session ses,
	v$sess_io sio
where 	ses.SID = sio.SID
) where username = 'RPTDEV7'
order by machine, pid, sid

Then kill the session with
 [2009-04-25 14:57 UTC]
Please try using this CVS snapshot:
For Windows:

 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-05-04 17:02 UTC] jarismar dot php at gmail dot com
Reproduced with PHP Version 5.2.10-dev (Build Date Apr 26 2009 23:39:22)

Someone else have been able to reproduced this bug ? Here is some instructions on how to do it :
1. run the snipped once
2. kill the persistent connection on oracle (see sqls on the second note)
3. run the snipped again

So infortunatelly the bug is not yet fixed on 5.2.10-dev.
 [2009-05-12 22:04 UTC]
Please try using this CVS snapshot:
For Windows:

This bug should be fixed after applying the fix for #48070
 [2009-05-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2016-03-08 01:43 UTC]
-Package: PDO related +Package: PDO OCI
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Feb 28 08:01:25 2021 UTC