ID:               42496
 Comment by:       michael dot virnstein at brodos dot de
 Reported By:      iddekingej at lycos dot com
 Status:           Open
 Bug Type:         OCI8 related
 Operating System: win 2000
 PHP Version:      5.2.4
 New Comment:

Ok, see Bug #43492 for the result set issue


Previous Comments:
------------------------------------------------------------------------

[2007-12-04 02:13:07] [EMAIL PROTECTED]

Thanks for the information.  Can you please open a new bug for the
result set issue.  Let's use this (#42496) bug only for any issues with
the LOB fix.

------------------------------------------------------------------------

[2007-11-30 16:36:04] michael dot virnstein at brodos dot de

I tried to remove "zend_list_addref(outcol->statement->id);" from
SQLT_RSET in php_oci_define_callback function() as well, but that
doesn't work really well. It seemed to work at first, but it creates
problems when returning the cursor from a function, because it leads to
"ORA-01001: invalid cursor" when i try to fetch from the returned
cursor.

Testcase:
<?php
 
$conn = ocilogon('user', 'pass', 'db');
 
function fetch($conn, $id)
{
    $result = null;
    $stmt = ociparse($conn, 'select cursor(select * from dual) c from
dual');
    ociexecute($stmt, OCI_DEFAULT);
    ocifetchinto($stmt, $result, OCI_ASSOC);
    ociexecute($result['C'], OCI_DEFAULT);
    return $result['C'];
}

for ($id = 1; $id <= 300; $id++) {
    $cur = fetch($conn, $id);
    ocifetchinto($cur, $row, OCI_ASSOC);
    ocifreestatement($cur);    
}
?>

When i run the code above without removing
"zend_list_addref(outcol->statement->id);" from SQLT_RSET i have the
problem, that i get an "ORA-01000: maximum open cursors exceeded",
because the statement within the function doesn't get closed. 

I don't know if that can be implemented easily, but the best thing
would be, that a cursor gets closed if it is already out of scope and
therefore not accessible from the php-code anymore and all nested
cursors got closed already.

------------------------------------------------------------------------

[2007-11-30 16:30:55] michael at six dot de

Same problem here: php 5.2.5 with oracle 11g client (linux 64bit)
against oracle 10.2.0.3 server (solaris 10 sparc 64bit).
Patch works ok, no ORA-01000 errors anymore.

------------------------------------------------------------------------

[2007-11-30 10:05:28] michael dot virnstein at brodos dot de

Thanks, this fix works for lobs, but i investigated a bit further and
realized, that the same problem occures when returning cursors. 
To totally remove the problem you would have to remove
"zend_list_addref(outcol->statement->id);" from SQLT_RSET in
php_oci_define_callback() also. 
I don't know if this is the right solution at all, i'm not that much
into the php-engine, oci8-library and C in general. Wouldn't it be
better to close all related cursors when closing the "main"-cursor
instead of not registering them?

------------------------------------------------------------------------

[2007-11-29 18:01:29] [EMAIL PROTECTED]

This was reproduced with 5.2.3 on Linux.
Please try this patch AND LET US KNOW THE RESULT - thanks!

In php_oci_define_callback function [oci8_statement.c],
zend_list_addref is called for every lob column of each row.  When we
commented out this increment, the statements were destroyed and no
cursor leaks were seen.

case SQLT_RDD:
case SQLT_BLOB:
case SQLT_CLOB:
case SQLT_BFILE: {
...
descr = php_oci_lob_create(outcol->statement->connection, dtype
TSRMLS_CC);
               if (!descr) {
                   return OCI_ERROR;
               }
               /*zend_list_addref(outcol->statement->id); Commented out
*/


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/42496

-- 
Edit this bug report at http://bugs.php.net/?id=42496&edit=1

Reply via email to