ID: 33747
User updated by: alfred dot trapp at tvi-services dot de
-Summary: Too many Oracle-Sessions on INSERT Statements
Reported By: alfred dot trapp at tvi-services dot de
-Status: Feedback
+Status: Open
Bug Type: OCI8 related
Operating System: Linux
PHP Version: 5CVS-2005-07-19
New Comment:
Hi tony
Simplified Program Code
$connection=ocilogon($user, $pwd, $sid);
$tablename="RESULT_".$user;
for($i=0;$i<count($result);$i++){
$queryinsert="INSERT INTO $tablename (".$tabinsert.") ".
"VALUES (".$result[$i].")";
$stmt=ociparse($connection,$queryinsert);
ociexecute($stmt);
unset($queryinsert);
}
ocifreestatement($stmt);
ocilogoff($connection);
u'r welcome
Previous Comments:
------------------------------------------------------------------------
[2005-07-20 14:07:19] [EMAIL PROTECTED]
Please provide a clean, short and OCI8-only reproduce script. Without
all those $_SESSION, fopen etc. Just a short code that contains only
oci8*() calls and reproduces the problem.
Thanks.
------------------------------------------------------------------------
[2005-07-19 10:20:13] alfred dot trapp at tvi-services dot de
Hi sniper,
thanks for the proposal, but first tests with latest win32
PHP/5.1.0-dev indicates the same bug.
------------------------------------------------------------------------
[2005-07-18 13:05:22] alfred dot trapp at tvi-services dot de
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 this bug report at http://bugs.php.net/?id=33747&edit=1