php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29902 oci8 doesn't disconnect sessions, overloads oracle server
Submitted: 2004-08-30 20:54 UTC Modified: 2005-09-08 11:49 UTC
From: jwoodrich at avaya dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5.0.1 OS: Solaris 7
Private report: No CVE-ID: None
 [2004-08-30 20:54 UTC] jwoodrich at avaya dot com
Description:
------------
PHP's oci8 opens connections to the database server but does not disconnect.  This appears to be done for each instance of apache that uses PHP oci8.  Eventually the maximum number of sessions is reached on the database server and no more connections can be made.  This has occured on three different Solaris servers (two v7 and one v8) running PHP 5.0.1.  After downgrading to PHP 4.3.8 the problem disappeared and connections disappeared from session listing in Oracle as web transactions completed.

Config line:
./configure --with-apxs --with-oci8 \
            --enable-ftp --with-curl --with-informix \
            --with-imap \
            --with-ldap --with-gd --with-jpeg- \
            --with-pgsql \
            --with-libxml-dir \
            --prefix \
            --with-png-dir --with-zlib --enable-pcntl --disable-debug

Oracle Server version: 8.1.7.2
Oracle Client version: 8.1.7



Reproduce code:
---------------
Example:
$dbh=ocilogon("LOGIN","PASSWORD","DATABASE");
$sth=ociparse($dbh,"select sysdate from dual");
ociexecute($sth);
ocifetchinto($sth,&$svret,OCI_ASSOC+OCI_RETURN_NULLS);
ocifreestatement($sth);
oci_close($dbh);
var_dump($svret);


Expected result:
----------------
array(1) { ["SYSDATE"]=>string(11) "<<the time>>" }

Actual result:
--------------
Once the maximum number of sessions is reached this error message is returned: ORA-00604: error occurred at recursive SQL level 1 ORA-00018: maximum number of sessions exceeded 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-31 07:16 UTC] tony2001@php.net
OCI8 module doesn't close connections and leaves this duty to the Oracle server. That was done intentionally long time ago and that's how it works. Currently all OCI8 connections are persistent (except those established with oci_new_connect()/ocinlogon()), i.e. most often you will have one OCI8 connection for each Apache child. You should tune your Oracle to be able to close connections after a timeout.
Look here http://php.net/oci_close for additional info.
 [2005-09-08 11:49 UTC] tony2001@php.net
The bug has been fixed in OCI8 v.1.1, which is available in CVS HEAD and PECL (use `pear install oci8-beta` to install it).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 08:01:28 2024 UTC