From:             j dot henge-ernst at interexa dot de
Operating system: linux
PHP version:      5.2.10
PHP Bug Type:     OCI8 related
Bug description:  OCI_RETURN_LOBS causes php_shutdown to take very long

Description:
------------
If you read a lot of clobs/blob via oci_fetch_array($stmt,
OCI_RETURN_NULLS+OCI_ASSOC+OCI_RETURN_LOBS) it causes php_shutdown to take
a very long time.

Depending on the rows you read via oci_fetch_array the php_shutdown takes
longer and longer. Examples:

10.000  rows read with one lob column  0.1 seconds
20.000  rows read with one lob column    2 seconds
30.000  rows read with one lob column    8 seconds
40.000  rows read with one lob column   28 seconds
50.000  rows read with one lob column   60 seconds
100.000 rows read with one lob column 1800 seconds

This also happens if you skip the OCI_RETURN_LOBS and you don't use ->free
on the returned lob-object.

Tested with oci8 extension form php 5.2.10 and php 5.3.0

Reproduce code:
---------------
$conn       = oci_connect($user, $user, $db);
$tcst = oci_parse($conn, 'CREATE TABLE TESTTABLE ( PK NUMBER NOT NULL, TB
BLOB , CONSTRAINT TABLE1_PK PRIMARY KEY ( PK) ENABLE)');
oci_execute($tcst);
oci_free_statement($tcst);
for ($i = 1; $i <= 10000; ++$i) {
     $stmt = oci_parse($conn, "insert into testtable (PK, TB) values(:PK,
:TB)");
     oci_bind_by_name($stmt, ':PK', $i, -1);
     $lob  = oci_new_descriptor($conn, OCI_DTYPE_LOB);
     oci_bind_by_name($stmt, ':TB', $lob, -1, OCI_B_BLOB);
     $lob->writeTemporary('aaaaaaaaaaaaaaaaaaaa', OCI_TEMP_BLOB);
     oci_execute($stmt, OCI_DEFAULT);
     $lob->close();
     $lob->free();
     oci_free_statement($stmt);
}
oci_commit($conn);
for ($i = 0; $i <= 10; ++$i) {
    $stmt = oci_parse($conn, 'Select PK, TB FROM TESTTABLE');
    oci_execute($stmt, OCI_DEFAULT);
    OCISetPrefetch($stmt, 100);
    while (($row = oci_fetch_array($stmt,
OCI_RETURN_NULLS+OCI_ASSOC+OCI_RETURN_LOBS )) !== false);
    oci_free_statement($stmt);
}



-- 
Edit bug report at http://bugs.php.net/?id=49560&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49560&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49560&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49560&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49560&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49560&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49560&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49560&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49560&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49560&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49560&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49560&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49560&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49560&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49560&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49560&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49560&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49560&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49560&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49560&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49560&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49560&r=mysqlcfg

Reply via email to