From:             alfred dot trapp at tvi-services dot de
Operating system: Linux
PHP version:      5.0.4
PHP Bug Type:     OCI8 related
Bug description:  php5: Too many Oracle-Sessions on INSERT Statements

Description:
------------
We have an application currently running without problems (Fedora 3 + PHP
4.3.3(from source) + apache 1.3.33(from source) + Oracle Client 9.2
oci8).
Now we have tested php 5.0.4 with Oracle Client 9.2 / 10.1 connecting to
an Oracle 9.2 Database with either ocilogon, ocinlogon and ociplogon
making around 500 INSERTS in a loop. On database side we get a so called
Oracle Session Explode
while inserting, doing around 30 inserts with data and the rest are empty
INSERTS without any (NULL) values. Actually there are around 50 Oracle
Sessions opened, most of them without any data (detected with
PL/SQL-Developer from Allround Automations). 
Also we get >>Number of Sessions exceeded<< from the Database.
On the productive version with php 4.3.3 we have one Oracle Session with
all 500 rows full of correct data inserted.


Reproduce code:
---------------
Configure Command 
         
'./configure' '--build=i686-redhat-linux-gnu'
'--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib'
'--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--with-apxs2' '--disable-rpath' '--with-bz2' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr'
'--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif'
'--enable-ftp' '--enable-magic-quotes' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg'
'--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx'
'--with-pear=/usr/share/pear' '--with-kerberos' '--enable-ucd-snmp-hack'
'--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop'
'--enable-calendar' '--enable-dbx' '--enable-dio'
'--with-oci8=/db/oracle/product/10.1/client'
'--with-mime-magic=/usr/share/file/magic.mime' '--without-sqlite'
'--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs'
'--without-mysql' '--without-gd' '--without-odbc' '--disable-dom'
'--disable-dba'

Program Code

$connection=ocilogon($g_tvp_user, $g_tvp_pw, $g_tvp_sid);                 
 
$tabellenname="ERGEBNISSE_".$_SESSION['tvipilot']['user_id'];
for($i=0;$i<count($a_feldwerte);$i++){
        if($a_feldwerte[$i]!="''" && $a_feldwerte[$i]){
            $queryinsert="INSERT INTO $tabellenname (".$tabinsert.") VALUES
(".$a_feldwerte[$i].")";
        $stmt=ociparse($connection,$queryinsert);
                if(true!=ociexecute($stmt)){
 
                        
$dateiname="log/statement".$_SESSION['tvipilot']['user_id']."_".$_SESSION['tvipilot']['arbeitsprofil']."_".$_SESSION['tvipilot']['darstellungsprofil'].".log";
                        $fh_rs=fopen($dateiname,"a");
                        if (!fwrite($fh_rs, $queryinsert."\n")) {
                                print ("Kann in die Datei $dateiname nicht 
schreiben\n");
                        }
                        fclose($fh_rs);
                }
        unset($queryinsert);
    }
}
ocifreestatement($stmt);
ocilogoff($connection);

php.ini Modifications

max_execution_time = 600     
max_input_time = 300    
memory_limit = 128M 
extension_dir = "/usr/lib/php/modules"

Expected result:
----------------
One Oracle Session with all 500 rows full of correct data inserted.

Actual result:
--------------
On database side we get a so called Oracle Session Explode
while inserting, doing around 30 inserts with data and the rest are empty
INSERTS without any (NULL) values. Actually there are around 50 Oracle
Sessions opened, most of them without any data (detected with
PL/SQL-Developer from Allround Automations).

-- 
Edit bug report at http://bugs.php.net/?id=33747&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33747&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33747&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33747&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33747&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33747&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33747&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33747&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33747&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33747&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33747&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33747&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33747&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33747&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33747&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33747&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33747&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33747&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33747&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33747&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33747&r=mysqlcfg

Reply via email to