php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56569 oci_new_connect() not closed by oci_close()
Submitted: 2005-09-30 07:04 UTC Modified: 2005-10-03 09:02 UTC
From: p dot m at iol dot it Assigned: tony2001 (profile)
Status: Closed Package: oci8 (PECL)
PHP Version: 5_1 CVS-2005-09-30 (dev) OS: Linux Redhat 9
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: p dot m at iol dot it
New email:
PHP Version: OS:

 

 [2005-09-30 07:04 UTC] p dot m at iol dot it
Description:
------------
My application needs to open several isolated connections to the same Oracle database and to close them when done.
To obtain this I use oci_new_connect() call and oci_close()
when done. I can notice an increasing number of open sessions on oracle side.

Install & test procedure followed:
Got php-5.1.0RC1.tar.gz  and oci8-1.1.1.tgz
unpack php-5.1.0RC1.tar.gz
unpack oci8-1.1.1.tgz in ./ext
cd <php source home>
rm -rf ext/oci8
mv ext/oci8-1.1.1 ext/oci8
rm -f ext/package.xml
./buildconf --force  # it complains without force
INCLUDES="-I/usr/kerberos/include" ./configure \
  --with-apxs2=/home/wadmin/apache/bin/apxs \
  --prefix=/home/wadmin/apache/php4module \
  --with-config-file-path=/home/wadmin/apache/php4module \
  --disable-cgi \
  \
  --with-gdbm \
  --with-gd \
  --with-ttf \
  --enable-gd-native-ttf \
  --with-t1lib \
  --with-libxml-dir=/home/wadmin/apache/php4module \
  \
  --with-mysql \
  --with-oci8=/home/wadmin/9i/product/9.2.0 \
  --with-zlib \
  --with-pear \
  \
  --enable-soap \
  --enable-sigchild \
  --enable-ftp \
  --enable-safe-mode \
  --enable-magic-quotes \
  --enable-shmop \
  --enable-memory-limit \
  \
  --without-sqlite \
  --disable-spl \
  \
  --with-xmlrpc \
  --with-openssl \
  --with-pcntl \
  --disable-ipv6 \
  --enable-pcntl
make
make install
[No oci.* options are in my php.ini]
[run test script]

Reproduce code:
---------------
#!/home/wadmin/apache/php4module/bin/php
<?
  ini_set('oci8.max_persistent', 3) ;
  $o_user = 'SCOTT' ; $o_pwd = 'TIGER';
  $o_instance = 'FOOBAR' ;
  for ($iloop=0; $iloop < 4; $iloop++) {
      printf("PID %d: User %s on %s\n", posix_getpid(),
        $o_user, $o_instance) ;
      $oconn = oci_new_connect(
        $o_user, $o_pwd, $o_instance);
      $epa = oci_parse($oconn, sprintf(
        'select sid, username, machine, program, process, to_char(LOGON_TIME, \'YYYYMMDD HH24:MI:SS\') as login_time from v$session where SCHEMANAME = \'%s\'',
        $o_user));

      $eex = oci_execute($epa);
      $n_rows = oci_fetch_all($epa, $risultati, 0, -1,
        OCI_FETCHSTATEMENT_BY_ROW);
      foreach ($risultati as $irow => $rset) {
        foreach ($rset as $campo => $valore) {
            printf("%s='%s', ", $campo, $valore) ;
        }
        print "\n" ;
      }
      print "\n" ;
      oci_free_statement($epa);
      oci_close($oconn) ;
      sleep(5) ; // wait before next connection
  }
?>

Expected result:
----------------
I expect to have always only ONE line of output referring my PID and my MACHINE.
The new oci_close() doc page states:
 oci_close() closes the Oracle connection connection.
    Note: Starting from the version 1.1 oci_close() correctly closes the Oracle connection.

Actual result:
--------------
# connections survive to oci_close():

PHP Warning:  Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PID 7663: User SCOTT on FOOBAR
SID='78', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:48',

PID 7663: User SCOTT on FOOBAR
SID='78', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:48',
SID='110', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:53',

PID 7663: User SCOTT on FOOBAR
SID='78', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:48',
SID='110', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:53',
SID='137', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:58',

PID 7663: User SCOTT on FOOBAR
SID='78', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:48',
SID='109', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:32:03',
SID='110', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:53',
SID='137', USERNAME='SCOTT', MACHINE='clienthost.mydom.it',
  PROGRAM='php@clienthost.mydom.it (TNS V1-', PROCESS='7663', LOGIN_TIME='20050930 11:31:58',

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-30 07:56 UTC] tony2001 at phpclub dot net
Ok, I got a patch, but I need to discuss it first.
 [2005-10-03 09:02 UTC] tony2001 at phpclub dot net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC